diff --git a/.gitignore b/.gitignore
index 9511e9ede..f41862895 100644
--- a/.gitignore
+++ b/.gitignore
@@ -59,10 +59,10 @@ tools/cli/build/
*.iso
*.tar.gz
*.tgz
+target-eclipse
awsapi/modules/*
!.gitignore
.classpath
-.project
.settings.xml
.settings/
db.properties.override
@@ -73,4 +73,13 @@ docs/tmp
docs/publish
docs/runbook/tmp
docs/runbook/publish
+.project
Gemfile.lock
+debian/tmp
+debian/files
+debian/cloudstack-*/*
+debian/*.substvars
+debian/*.debhelper
+replace.properties.tmp
+build-indep-stamp
+configure-stamp
diff --git a/CHANGES b/CHANGES
index a745a467c..a1edfdac5 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,7 +1,7 @@
Apache CloudStack (Incubating) CHANGES
======================================
-Full release notes for each release are located in the project's documentation website: http://incubator.apache.org/cloudstack/docs
+Full release notes for each release are located in the project's documentation website: http://cloudstack.apache.org/docs
Version 4.0.0-incubating
------------------------
diff --git a/DISCLAIMER b/DISCLAIMER
deleted file mode 100644
index fa1e9261a..000000000
--- a/DISCLAIMER
+++ /dev/null
@@ -1,7 +0,0 @@
-Apache CloudStack is an effort undergoing incubation at The Apache Software Foundation (ASF),
-sponsored by the Apache Incubator. Incubation is required of all newly accepted
-projects until a further review indicates that the infrastructure, communications, and
-decision making process have stabilized in a manner consistent with other successful ASF
-projects. While incubation status is not necessarily a reflection of the completeness or
-stability of the code, it does indicate that the project has yet to be fully endorsed by
-the ASF.
diff --git a/INSTALL.md b/INSTALL.md
index 00c724b11..4f93900dd 100644
--- a/INSTALL.md
+++ b/INSTALL.md
@@ -1,7 +1,7 @@
This document describes how to develop, build, package and install Apache CloudStack
(Incubating). For more information please refer to the project's website:
- http://incubator.apache.org/cloudstack
+ http://cloudstack.apache.org
Apache CloudStack developers use various platforms for development, this guide
was tested against a CentOS 6.2 x86_64 setup.
@@ -51,19 +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, 8080: Apache CloudStack Management Server, User/Client API
- 8096: User/Client to CloudStack Management Server (unauthenticated)
- 7080: AWS API Server
- 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
@@ -75,7 +77,7 @@ Start the MySQL service:
You may get the source code from the repository hosted on Apache:
- $ git clone https://git-wip-us.apache.org/repos/asf/incubator-cloudstack.git
+ $ git clone https://git-wip-us.apache.org/repos/asf/cloudstack.git
Or, you may fork a repository from the official Apache CloudStack mirror by
Apache on [Github](https://github.com/apache/incubator-cloudstack)
@@ -93,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:
@@ -112,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:
@@ -122,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 73bc73839..2094d029e 100644
--- a/LICENSE
+++ b/LICENSE
@@ -180,73 +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)
-
- Copyright (c) 2005-2010 Thomas Nagy
-
- 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 Thomas Nagy http://code.google.com/p/waf/
- waf
-
-
-Within the awsapi directory
- licensed under the BSD (3-clause) http://www.opensource.org/licenses/BSD-3-Clause (as follows)
-
- Copyright (c) 2005-2010 Thomas Nagy
-
- 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 Thomas Nagy http://code.google.com/p/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 +203,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 +236,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 +285,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/{devcloud,systemvmtemplate,systemvmtemplate64} directories
+ 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 +403,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 +454,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 +480,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 +506,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 +532,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 +559,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 +595,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 +620,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 +646,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,14 +675,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/
+ ScriptRunner.java from http://code.google.com/p/mybatis/
+
diff --git a/NOTICE b/NOTICE
index 5cdd9fcee..d36048aab 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
@@ -76,4 +75,4 @@
Inspiration from jQuery color animation plugin by John Resig.
- Released under the MIT license by Ole Laursen, October 2009.
\ No newline at end of file
+ Released under the MIT license by Ole Laursen, October 2009.
diff --git a/README.md b/README.md
index 7b4d97366..7fb9b57c5 100644
--- a/README.md
+++ b/README.md
@@ -17,12 +17,14 @@ Apache CloudStack offers three methods for managing cloud
computing environments: an easy to use Web interface, command
line tools, and a full-featured RESTful API.
-Visit us at [cloudstack.org](http://incubator.apache.org/cloudstack).
+Visit us at [Apache CloudStack](http://cloudstack.apache.org).
## Mailing lists
-[Development Mailing List](mailto:cloudstack-dev-subscribe@incubator.apache.org)
-[Users Mailing list](mailto:cloudstack-users-subscribe@incubator.apache.org)
-[Commits mailing list](mailto:cloudstack-commits-subscribe@incubator.apache.org)
+[Development Mailing List](mailto:dev-subscribe@cloudstack.apache.org)
+[Users Mailing List](mailto:users-subscribe@cloudstack.apache.org)
+[Commits Mailing List](mailto:commits-subscribe@cloudstack.apache.org)
+[Issues Mailing List](mailto:issues-subscribe@cloudstack.apache.org)
+[Marketing Mailing List](mailto:marketing-subscribe@cloudstack.apache.org)
# License
diff --git a/README.tools.md b/README.tools.md
index f743c8927..069c34269 100644
--- a/README.tools.md
+++ b/README.tools.md
@@ -61,7 +61,7 @@ Once installed per the Vagrant installation process, run:
$ vagrant box add devcloud [path to devcloud.box]
Then, either go into the devcloudbox folder of your checked out version of the
-CloudStack code (incubator-cloudstack/tools/devcloud/devcloudbox), or copy the
+CloudStack code (cloudstack/tools/devcloud/devcloudbox), or copy the
contents of that folder to another location.
Assuming the patched Vagrant installation is working, you then
diff --git a/agent/conf/agent.properties b/agent/conf/agent.properties
index 74cfd1c21..e49afbf2a 100644
--- a/agent/conf/agent.properties
+++ b/agent/conf/agent.properties
@@ -79,4 +79,13 @@ domr.scripts.dir=scripts/network/domr/kvm
# 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
+#libvirt.vif.driver=com.cloud.hypervisor.kvm.resource.BridgeVifDriver
+
+# set the hypervisor type, values are: kvm, lxc
+# hypervisor.type=kvm
+
+# settings to enable direct networking in libvirt, should not be used
+# on hosts that run system vms, values for mode are: private, bridge, vepa
+# libvirt.vif.driver=com.cloud.hypervisor.kvm.resource.DirectVifDriver
+# network.direct.source.mode=private
+# network.direct.device=eth0
diff --git a/agent/pom.xml b/agent/pom.xml
index 810f33fc5..0f44c1aa2 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
@@ -35,8 +35,6 @@
org.apache.cloudstack
cloud-utils
${project.version}
- tests
- test
@@ -83,7 +81,7 @@
+ value="${cs.replace.properties}" />
@@ -97,7 +95,7 @@
+ value="${cs.replace.properties}" />
@@ -106,6 +104,24 @@
+
+ org.apache.maven.plugins
+ maven-dependency-plugin
+ 2.5.1
+
+
+ copy-dependencies
+ package
+
+ copy-dependencies
+
+
+ ${project.build.directory}/dependencies
+ runtime
+
+
+
+
diff --git a/agent/src/com/cloud/agent/AgentShell.java b/agent/src/com/cloud/agent/AgentShell.java
index e3d1063e6..73b3950e7 100644
--- a/agent/src/com/cloud/agent/AgentShell.java
+++ b/agent/src/com/cloud/agent/AgentShell.java
@@ -42,21 +42,20 @@
import org.apache.commons.httpclient.MultiThreadedHttpConnectionManager;
import org.apache.commons.httpclient.methods.GetMethod;
import org.apache.log4j.Logger;
+import org.apache.log4j.xml.DOMConfigurator;
import com.cloud.agent.Agent.ExitStatus;
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 +145,7 @@ public String getGuid() {
return _guid;
}
+ @Override
public Map getCmdLineProperties() {
return _cmdLineProperties;
}
@@ -371,6 +371,7 @@ protected boolean parseCommand(final String[] args)
throw new ConfigurationException("Unable to find the guid");
}
_guid = UUID.randomUUID().toString();
+ _properties.setProperty("guid", _guid);
}
return true;
@@ -378,8 +379,18 @@ protected boolean parseCommand(final String[] args)
public void init(String[] args) throws ConfigurationException {
- final ComponentLocator locator = ComponentLocator.getLocator("agent");
-
+ // PropertiesUtil is used both in management server and agent packages,
+ // it searches path under class path and common J2EE containers
+ // For KVM agent, do it specially here
+
+ File file = new File("/etc/cloudstack/agent/log4j-cloud.xml");
+ if(file == null || !file.exists()) {
+ file = PropertiesUtil.findConfigFile("log4j-cloud.xml");
+ }
+ DOMConfigurator.configureAndWatch(file.getAbsolutePath());
+
+ s_logger.info("Agent started");
+
final Class> c = this.getClass();
_version = c.getPackage().getImplementationVersion();
if (_version == null) {
@@ -396,12 +407,9 @@ public void init(String[] args) throws ConfigurationException {
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 +418,9 @@ public void init(String[] args) throws ConfigurationException {
_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 +464,7 @@ private void launchConsoleProxy() throws ConfigurationException {
openPortWithIptables(port);
_consoleProxyMain = new Thread(new Runnable() {
+ @Override
public void run() {
try {
Class> consoleProxyClazz = Class.forName("com.cloud.consoleproxy.ConsoleProxy");
@@ -522,7 +518,7 @@ private void launchAgentFromClassInfo(String resourceClassNames)
} 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 +530,7 @@ private void launchAgentFromClassInfo(String resourceClassNames)
} 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: "
@@ -571,6 +567,9 @@ public synchronized int getNextAgentId() {
public void start() {
try {
+ /* By default we only search for log4j.xml */
+ LogUtils.initLog4j("log4j-cloud.xml");
+
System.setProperty("java.net.preferIPv4Stack", "true");
String instance = getProperty(null, "instance");
diff --git a/agent/src/com/cloud/agent/VmmAgentShell.java b/agent/src/com/cloud/agent/VmmAgentShell.java
index ef2ef0f32..190d11682 100644
--- a/agent/src/com/cloud/agent/VmmAgentShell.java
+++ b/agent/src/com/cloud/agent/VmmAgentShell.java
@@ -23,7 +23,6 @@
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.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 @@
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;
- }
-
- public String getProperty(String prefix, String name) {
- if(prefix != null)
- return _properties.getProperty(prefix + "." + name);
-
- 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);
}
-
- @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 {
+
+ 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 @@ private void loadProperties() throws ConfigurationException {
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 @@ protected boolean parseCommand(final String[] args) throws ConfigurationExceptio
System.out.println("Invalid Parameter: " + args[i]);
continue;
}
-
+
// save command line properties
_cmdLineProperties.put(tokens[0], tokens[1]);
@@ -222,14 +217,14 @@ protected boolean parseCommand(final String[] args) throws ConfigurationExceptio
} 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 @@ protected boolean parseCommand(final String[] args) throws ConfigurationExceptio
}
_port = NumbersUtil.parseInt(port, 8250);
-
+
_proxyPort = NumbersUtil.parseInt(getProperty(null, "consoleproxy.httpListenPort"), 443);
if (workers == null) {
@@ -254,42 +249,42 @@ protected boolean parseCommand(final String[] args) throws ConfigurationExceptio
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 @@ private void launchAgentFromTypeInfo() throws ConfigurationException {
}
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 @@ private void launchAgentFromClassInfo(String resourceClassNames) throws Configur
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 @@ private void run(String[] args) {
// 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 @@ private void run(String[] args) {
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);
- }
-
- 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);
- }
-
- // class to handle the bootstrap command from the management server
- private class AgentBootStrapHandler extends Task {
-
- public AgentBootStrapHandler(Task.Type type, Link link, byte[] data) {
- super(type, link, data);
- }
-
- @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) {
-
- StartupVMMAgentCommand vmmCmd = (StartupVMMAgentCommand) cmd;
-
- _zone = Long.toString(vmmCmd.getDataCenter());
- _cmdLineProperties.put("zone", _zone);
-
- _pod = Long.toString(vmmCmd.getPod());
- _cmdLineProperties.put("pod", _pod);
-
- _cluster = vmmCmd.getClusterName();
- _cmdLineProperties.put("cluster", _cluster);
-
- _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
- }
- }
- }
- }
+ }
+
+ @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);
+ }
+
+ // class to handle the bootstrap command from the management server
+ private class AgentBootStrapHandler extends Task {
+
+ public AgentBootStrapHandler(Task.Type type, Link link, byte[] data) {
+ super(type, link, data);
+ }
+
+ @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) {
+
+ StartupVMMAgentCommand vmmCmd = (StartupVMMAgentCommand) cmd;
+
+ _zone = Long.toString(vmmCmd.getDataCenter());
+ _cmdLineProperties.put("zone", _zone);
+
+ _pod = Long.toString(vmmCmd.getPod());
+ _cmdLineProperties.put("pod", _pod);
+
+ _cluster = vmmCmd.getClusterName();
+ _cmdLineProperties.put("cluster", _cluster);
+
+ _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 058aefa92..000000000
--- 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 b94ae83fd..2bf26f486 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 boolean stop() {
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 11ea82490..73a994e8b 100644
--- a/agent/src/com/cloud/agent/dhcp/FakeDhcpSnooper.java
+++ b/agent/src/com/cloud/agent/dhcp/FakeDhcpSnooper.java
@@ -139,4 +139,34 @@ public InetAddress getDhcpServerIP() {
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 573f639b0..37a8b3d67 100755
--- a/agent/src/com/cloud/agent/resource/DummyResource.java
+++ b/agent/src/com/cloud/agent/resource/DummyResource.java
@@ -224,4 +224,34 @@ public IAgentControl getAgentControl() {
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 48f507900..991764c53 100644
--- a/agent/src/com/cloud/agent/resource/consoleproxy/ConsoleProxyResource.java
+++ b/agent/src/com/cloud/agent/resource/consoleproxy/ConsoleProxyResource.java
@@ -26,6 +26,7 @@
import java.lang.reflect.Method;
import java.net.URL;
import java.net.URLConnection;
+import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
@@ -234,14 +235,14 @@ public boolean configure(String name, Map params)
if (_eth1ip != null) {
params.put("private.network.device", "eth1");
} else {
- s_logger.warn("WARNING: eth1ip parameter is not found!");
+ s_logger.info("eth1ip parameter has not been configured, assuming that we are not inside a system vm");
}
String eth2ip = (String) params.get("eth2ip");
if (eth2ip != null) {
params.put("public.network.device", "eth2");
} else {
- s_logger.warn("WARNING: eth2ip parameter is not found!");
+ s_logger.info("eth2ip parameter is not found, assuming that we are not inside a system vm");
}
super.configure(name, params);
@@ -489,4 +490,26 @@ public void ensureRoute(String address) {
}
}
}
+
+ @Override
+ public void setName(String name) {
+ }
+
+ @Override
+ public void setConfigParams(Map params) {
+ }
+
+ @Override
+ public Map getConfigParams() {
+ return new HashMap();
+ }
+
+ @Override
+ public int getRunLevel() {
+ return 0;
+ }
+
+ @Override
+ public void setRunLevel(int level) {
+ }
}
diff --git a/agent/test/com/cloud/agent/TestAgentShell.java b/agent/test/com/cloud/agent/TestAgentShell.java
index d7210acbe..b0f748067 100644
--- a/agent/test/com/cloud/agent/TestAgentShell.java
+++ b/agent/test/com/cloud/agent/TestAgentShell.java
@@ -19,24 +19,23 @@
import java.io.File;
import java.io.IOException;
-import org.apache.log4j.Logger;
+import junit.framework.TestCase;
-import com.cloud.agent.AgentShell;
-import com.cloud.utils.testcase.Log4jEnabledTestCase;
+import org.apache.log4j.Logger;
-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 7461c67aa..8ca258f12 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/BackupSnapshotCommand.java b/api/src/com/cloud/agent/api/BackupSnapshotCommand.java
index a0ac8d7ad..cac686dc0 100644
--- a/api/src/com/cloud/agent/api/BackupSnapshotCommand.java
+++ b/api/src/com/cloud/agent/api/BackupSnapshotCommand.java
@@ -35,6 +35,7 @@ public class BackupSnapshotCommand extends SnapshotCommand {
private SwiftTO swift;
private S3TO s3;
StorageFilerTO pool;
+ private Long secHostId;
protected BackupSnapshotCommand() {
@@ -49,12 +50,14 @@ protected BackupSnapshotCommand() {
* @param firstBackupUuid This is the backup of the first ever snapshot taken by the volume.
* @param isFirstSnapshotOfRootVolume true if this is the first snapshot of a root volume. Set the parent of the backup to null.
* @param isVolumeInactive True if the volume belongs to a VM that is not running or is detached.
+ * @param secHostId This is the Id of the secondary storage.
*/
public BackupSnapshotCommand(String secondaryStoragePoolURL,
Long dcId,
Long accountId,
Long volumeId,
Long snapshotId,
+ Long secHostId,
String volumePath,
StoragePool pool,
String snapshotUuid,
@@ -71,6 +74,7 @@ public BackupSnapshotCommand(String secondaryStoragePoolURL,
this.prevBackupUuid = prevBackupUuid;
this.isVolumeInactive = isVolumeInactive;
this.vmName = vmName;
+ this.secHostId = secHostId;
setVolumePath(volumePath);
setWait(wait);
}
@@ -111,4 +115,7 @@ public Long getSnapshotId() {
return snapshotId;
}
+ public Long getSecHostId() {
+ return secHostId;
+ }
}
diff --git a/api/src/com/cloud/agent/api/Command.java b/api/src/com/cloud/agent/api/Command.java
index 9cd67495e..aadbeaf0d 100755
--- a/api/src/com/cloud/agent/api/Command.java
+++ b/api/src/com/cloud/agent/api/Command.java
@@ -27,6 +27,8 @@
*/
public abstract class Command {
+ public static final String HYPERVISOR_TYPE = "hypervisorType";
+
// allow command to carry over hypervisor or other environment related context info
@LogLevel(Log4jLevel.Trace)
protected Map contextMap = new HashMap();
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 000000000..f9fb1642b
--- /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 000000000..478987d99
--- /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 a19d34436..fbf6121f5 100644
--- a/api/src/com/cloud/agent/api/CreateVolumeFromSnapshotCommand.java
+++ b/api/src/com/cloud/agent/api/CreateVolumeFromSnapshotCommand.java
@@ -18,6 +18,7 @@
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 000000000..ed3bc62cc
--- /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 000000000..634e15c9f
--- /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/DeleteSnapshotBackupCommand.java b/api/src/com/cloud/agent/api/DeleteSnapshotBackupCommand.java
index 611414895..128df84c7 100644
--- a/api/src/com/cloud/agent/api/DeleteSnapshotBackupCommand.java
+++ b/api/src/com/cloud/agent/api/DeleteSnapshotBackupCommand.java
@@ -19,6 +19,7 @@
import com.cloud.agent.api.LogLevel.Log4jLevel;
import com.cloud.agent.api.to.S3TO;
import com.cloud.agent.api.to.SwiftTO;
+import com.cloud.storage.StoragePool;
/**
* This command encapsulates a primitive operation which enables coalescing the backed up VHD snapshots on the secondary server
@@ -78,7 +79,8 @@ protected DeleteSnapshotBackupCommand() {
* @param backupUUID The VHD which has to be deleted
* @param childUUID The child VHD file of the backup whose parent is reset to its grandparent.
*/
- public DeleteSnapshotBackupCommand(SwiftTO swift,
+ public DeleteSnapshotBackupCommand(StoragePool pool,
+ SwiftTO swift,
S3TO s3,
String secondaryStoragePoolURL,
Long dcId,
@@ -86,7 +88,7 @@ public DeleteSnapshotBackupCommand(SwiftTO swift,
Long volumeId,
String backupUUID, Boolean all)
{
- super(null, secondaryStoragePoolURL, backupUUID, null, dcId, accountId, volumeId);
+ super(pool, secondaryStoragePoolURL, backupUUID, null, dcId, accountId, volumeId);
setSwift(swift);
this.s3 = s3;
setAll(all);
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 000000000..8f4ecad3d
--- /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 000000000..c213448bf
--- /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/RebootCommand.java b/api/src/com/cloud/agent/api/RebootCommand.java
index 299e61b76..49712b6fc 100755
--- a/api/src/com/cloud/agent/api/RebootCommand.java
+++ b/api/src/com/cloud/agent/api/RebootCommand.java
@@ -16,6 +16,7 @@
// under the License.
package com.cloud.agent.api;
+import com.cloud.hypervisor.Hypervisor;
import com.cloud.vm.VirtualMachine;
public class RebootCommand extends Command {
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 000000000..848ffc0eb
--- /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 000000000..429a186e0
--- /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/ScaleVmAnswer.java b/api/src/com/cloud/agent/api/ScaleVmAnswer.java
new file mode 100644
index 000000000..31d6e4415
--- /dev/null
+++ b/api/src/com/cloud/agent/api/ScaleVmAnswer.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;
+
+public class ScaleVmAnswer extends Answer {
+
+ protected ScaleVmAnswer() {
+ }
+
+ public ScaleVmAnswer(ScaleVmCommand cmd, boolean result, String detail) {
+ super(cmd, result, detail);
+ }
+
+}
diff --git a/api/src/com/cloud/agent/api/ScaleVmCommand.java b/api/src/com/cloud/agent/api/ScaleVmCommand.java
new file mode 100644
index 000000000..35d22ad9d
--- /dev/null
+++ b/api/src/com/cloud/agent/api/ScaleVmCommand.java
@@ -0,0 +1,113 @@
+// 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.VirtualMachineTO;
+
+public class ScaleVmCommand extends Command {
+
+ VirtualMachineTO vm;
+ String vmName;
+ int cpus;
+ Integer speed;
+ long minRam;
+ long maxRam;
+
+ public VirtualMachineTO getVm() {
+ return vm;
+ }
+
+ public void setVm(VirtualMachineTO vm) {
+ this.vm = vm;
+ }
+
+ public int getCpus() {
+ return cpus;
+ }
+
+ public ScaleVmCommand(String vmName, int cpus,
+ Integer speed, long minRam, long maxRam, boolean limitCpuUse) {
+ super();
+ this.vmName = vmName;
+ this.cpus = cpus;
+ this.speed = speed;
+ this.minRam = minRam;
+ this.maxRam = maxRam;
+ this.vm = new VirtualMachineTO(1L, vmName, null, cpus, speed, minRam, maxRam, null, null, false, false, null);
+ /*vm.setName(vmName);
+ vm.setCpus(cpus);
+ vm.setRam(minRam, maxRam);*/
+ }
+
+ public void setCpus(int cpus) {
+ this.cpus = cpus;
+ }
+
+ public Integer getSpeed() {
+ return speed;
+ }
+
+ public void setSpeed(Integer speed) {
+ this.speed = speed;
+ }
+
+ public long getMinRam() {
+ return minRam;
+ }
+
+ public void setMinRam(long minRam) {
+ this.minRam = minRam;
+ }
+
+ public long getMaxRam() {
+ return maxRam;
+ }
+
+ public void setMaxRam(long maxRam) {
+ this.maxRam = maxRam;
+ }
+
+ public String getVmName() {
+ return vmName;
+ }
+
+ public void setVmName(String vmName) {
+ this.vmName = vmName;
+ }
+
+ public VirtualMachineTO getVirtualMachine() {
+ return vm;
+ }
+
+ @Override
+ public boolean executeInSequence() {
+ return true;
+ }
+
+ protected ScaleVmCommand() {
+ }
+
+ public ScaleVmCommand(VirtualMachineTO vm) {
+ this.vm = vm;
+ }
+
+ public boolean getLimitCpuUse() {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+}
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 000000000..e938de73f
--- /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/SecurityGroupRulesCmd.java b/api/src/com/cloud/agent/api/SecurityGroupRulesCmd.java
index affad1f9b..4336b4c32 100644
--- a/api/src/com/cloud/agent/api/SecurityGroupRulesCmd.java
+++ b/api/src/com/cloud/agent/api/SecurityGroupRulesCmd.java
@@ -18,6 +18,7 @@
import java.io.ByteArrayOutputStream;
import java.io.IOException;
+import java.util.List;
import java.util.zip.DeflaterOutputStream;
import org.apache.commons.codec.binary.Base64;
@@ -80,6 +81,7 @@ public int getEndPort() {
Long msId;
IpPortAndProto [] ingressRuleSet;
IpPortAndProto [] egressRuleSet;
+ private List secIps;
public SecurityGroupRulesCmd() {
super();
@@ -103,6 +105,23 @@ public SecurityGroupRulesCmd(String guestIp, String guestMac, String vmName, Lon
}
+ public SecurityGroupRulesCmd(String guestIp, String guestMac, String vmName, Long vmId, String signature, Long seqNum, IpPortAndProto[] ingressRuleSet, IpPortAndProto[] egressRuleSet, List secIps) {
+ super();
+ this.guestIp = guestIp;
+ this.vmName = vmName;
+ this.ingressRuleSet = ingressRuleSet;
+ this.egressRuleSet = egressRuleSet;
+ this.guestMac = guestMac;
+ this.signature = signature;
+ this.seqNum = seqNum;
+ this.vmId = vmId;
+ if (signature == null) {
+ String stringified = stringifyRules();
+ this.signature = DigestUtils.md5Hex(stringified);
+ }
+ this.secIps = secIps;
+ }
+
@Override
public boolean executeInSequence() {
return true;
@@ -131,6 +150,10 @@ public String getGuestIp() {
return guestIp;
}
+ public List getSecIps() {
+ return secIps;
+ }
+
public String getVmName() {
return vmName;
@@ -165,6 +188,20 @@ private String compressCidr(String cidr) {
}
+ public String getSecIpsString() {
+ StringBuilder sb = new StringBuilder();
+ List ips = getSecIps();
+ if (ips == null) {
+ return "0:";
+ } else {
+ for (String ip : ips) {
+ sb.append(ip).append(":");
+ }
+ }
+ return sb.toString();
+ }
+
+
public String stringifyCompressedRules() {
StringBuilder ruleBuilder = new StringBuilder();
for (SecurityGroupRulesCmd.IpPortAndProto ipPandP : getIngressRuleSet()) {
diff --git a/api/src/com/cloud/agent/api/StopCommand.java b/api/src/com/cloud/agent/api/StopCommand.java
index 9ee7ce3c8..1c67f3816 100755
--- a/api/src/com/cloud/agent/api/StopCommand.java
+++ b/api/src/com/cloud/agent/api/StopCommand.java
@@ -38,10 +38,9 @@ public StopCommand(VirtualMachine vm, String vnet) {
super(vm);
this.vnet = vnet;
}
-
- public StopCommand(VirtualMachine vm, String vmName, String vnet) {
- super(vmName);
- this.vnet = vnet;
+
+ public StopCommand(VirtualMachine vm) {
+ super(vm);
}
public StopCommand(String vmName) {
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 000000000..2120f2f73
--- /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 000000000..c7b42d25b
--- /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 c5af38eb7..3befc2f6b 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 f0ce70e9a..fd8d84c8c 100644
--- a/api/src/com/cloud/agent/api/routing/DhcpEntryCommand.java
+++ b/api/src/com/cloud/agent/api/routing/DhcpEntryCommand.java
@@ -31,6 +31,7 @@ public class DhcpEntryCommand extends NetworkElementCommand {
String vmIp6Address;
String ip6Gateway;
String duid;
+ private boolean isDefault;
protected DhcpEntryCommand() {
@@ -46,6 +47,7 @@ public DhcpEntryCommand(String vmMac, String vmIpAddress, String vmName, String
this.vmIpAddress = vmIpAddress;
this.vmName = vmName;
this.vmIp6Address = vmIp6Address;
+ this.setDefault(true);
}
public DhcpEntryCommand(String vmMac, String vmIpAddress, String vmName, String vmIp6Address, String dns, String gateway, String ip6Gateway) {
@@ -129,4 +131,12 @@ public String getVmIp6Address() {
public void setVmIp6Address(String ip6Address) {
this.vmIp6Address = ip6Address;
}
+
+ public boolean isDefault() {
+ return isDefault;
+ }
+
+ public void setDefault(boolean isDefault) {
+ this.isDefault = isDefault;
+ }
}
diff --git a/api/src/com/cloud/agent/api/routing/GlobalLoadBalancerConfigAnswer.java b/api/src/com/cloud/agent/api/routing/GlobalLoadBalancerConfigAnswer.java
new file mode 100644
index 000000000..e5167fede
--- /dev/null
+++ b/api/src/com/cloud/agent/api/routing/GlobalLoadBalancerConfigAnswer.java
@@ -0,0 +1,27 @@
+// 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.routing;
+
+import com.cloud.agent.api.Answer;
+
+public class GlobalLoadBalancerConfigAnswer extends Answer{
+
+ public GlobalLoadBalancerConfigAnswer(boolean success, String details) {
+ this.result = success;
+ this.details = details;
+ }
+}
diff --git a/api/src/com/cloud/agent/api/routing/GlobalLoadBalancerConfigCommand.java b/api/src/com/cloud/agent/api/routing/GlobalLoadBalancerConfigCommand.java
new file mode 100644
index 000000000..b3603c8be
--- /dev/null
+++ b/api/src/com/cloud/agent/api/routing/GlobalLoadBalancerConfigCommand.java
@@ -0,0 +1,100 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package com.cloud.agent.api.routing;
+
+import com.cloud.agent.api.Command;
+
+import java.util.List;
+
+/**
+ * GlobalLoadBalancerConfigCommand used for sending the GSLB configuration to GSLB service provider
+ */
+public class GlobalLoadBalancerConfigCommand extends Command {
+
+ // FQDN that represents the globally load balanced service
+ String domainName;
+
+ // type of the globally load balanced service
+ String serviceType;
+
+ // load balancing method to distribute traffic across the sites participating in global service load balancing
+ String lbMethod;
+
+ // session persistence type
+ String persistenceType;
+
+ // unique Id given per gslb rule, that is uniquely represents glsb rule on all participant sites
+ long gslbId;
+
+ // true if global load balancer rule is being deleted
+ boolean revoked;
+
+ // list of the site details that are participating in the GSLB service
+ List siteLoadBalancers;
+
+ public GlobalLoadBalancerConfigCommand(String domainName,
+ String lbMethod,
+ String persistenceType,
+ String serviceType,
+ long gslbId,
+ boolean revoked) {
+ this.domainName = domainName;
+ this.serviceType = serviceType;
+ this.lbMethod = lbMethod;
+ this.persistenceType = persistenceType;
+ this.gslbId = gslbId;
+ this.revoked = revoked;
+ }
+
+ public List getSiteDetails() {
+ return siteLoadBalancers;
+ }
+
+ public void setSiteLoadBalancers(List siteLoadBalancers) {
+ this.siteLoadBalancers = siteLoadBalancers;
+ }
+
+ public String getServiceType() {
+ return serviceType;
+ }
+
+ public String getLoadBalancerMethod() {
+ return lbMethod;
+ }
+
+ public String getPersistenceType() {
+ return persistenceType;
+ }
+
+ public long getGslbId() {
+ return this.gslbId;
+ }
+
+ public String getDomainName() {
+ return domainName;
+ }
+
+ public boolean isForRevoke() {
+ return revoked;
+ }
+
+ @Override
+ public boolean executeInSequence() {
+ return false;
+ }
+}
diff --git a/api/src/com/cloud/agent/api/routing/HealthCheckLBConfigAnswer.java b/api/src/com/cloud/agent/api/routing/HealthCheckLBConfigAnswer.java
new file mode 100644
index 000000000..dfca4ab59
--- /dev/null
+++ b/api/src/com/cloud/agent/api/routing/HealthCheckLBConfigAnswer.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.routing;
+
+import java.util.List;
+
+import com.cloud.agent.api.Answer;
+import com.cloud.agent.api.to.LoadBalancerTO;
+import com.cloud.agent.api.to.NicTO;
+
+/**
+ * LoadBalancerConfigCommand sends the load balancer configuration
+ */
+public class HealthCheckLBConfigAnswer extends Answer {
+ List loadBalancers;
+
+ protected HealthCheckLBConfigAnswer() {
+ }
+
+ public HealthCheckLBConfigAnswer(List loadBalancers) {
+ this.loadBalancers = loadBalancers;
+ }
+
+ public List getLoadBalancers() {
+ return loadBalancers;
+ }
+
+}
diff --git a/api/src/com/cloud/agent/api/routing/HealthCheckLBConfigCommand.java b/api/src/com/cloud/agent/api/routing/HealthCheckLBConfigCommand.java
new file mode 100644
index 000000000..f705f6c97
--- /dev/null
+++ b/api/src/com/cloud/agent/api/routing/HealthCheckLBConfigCommand.java
@@ -0,0 +1,39 @@
+// 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.routing;
+
+import com.cloud.agent.api.to.LoadBalancerTO;
+import com.cloud.agent.api.to.NicTO;
+
+/**
+ * LoadBalancerConfigCommand sends the load balancer configuration
+ */
+public class HealthCheckLBConfigCommand extends NetworkElementCommand {
+ LoadBalancerTO[] loadBalancers;
+
+ protected HealthCheckLBConfigCommand() {
+ }
+
+ public HealthCheckLBConfigCommand(LoadBalancerTO[] loadBalancers) {
+ this.loadBalancers = loadBalancers;
+ }
+
+ public LoadBalancerTO[] getLoadBalancers() {
+ return loadBalancers;
+ }
+
+}
diff --git a/api/src/com/cloud/agent/api/routing/SiteLoadBalancerConfig.java b/api/src/com/cloud/agent/api/routing/SiteLoadBalancerConfig.java
new file mode 100644
index 000000000..cca5de831
--- /dev/null
+++ b/api/src/com/cloud/agent/api/routing/SiteLoadBalancerConfig.java
@@ -0,0 +1,121 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package com.cloud.agent.api.routing;
+
+// details of site participating in the GLSB service, represents configuration load balancer rule and the zone
+// in which the rule is configured
+public class SiteLoadBalancerConfig {
+
+ // true if the site details are local to the zone receiving 'GlobalLoadBalancerConfigCommand'
+ boolean local;
+
+ // true if the site needs to be removed from GSLB service
+ boolean revoked;
+
+ // service type of the 'site load balanced' service
+ String serviceType;
+
+ // public IP corresponding to the site load balanced service
+ String servicePublicIp;
+
+ // port corresponding to the site load balanced service
+ String servicePort;
+
+ // Private IP corresponding to the GSLB service provider in the site.
+ String gslbProviderPrivateIp;
+
+ // Public IP corresponding to the GSLB service provider in the site.
+ String gslbProviderPublicIp;
+
+ // zone id in which site is located
+ long dataCenterId;
+
+ public SiteLoadBalancerConfig(boolean revoked, String serviceType, String servicePublicIp, String servicePort,
+ long dataCenterId) {
+ this.revoked = revoked;
+ this.serviceType = serviceType;
+ this.servicePublicIp = servicePublicIp;
+ this.servicePort = servicePort;
+ this.dataCenterId = dataCenterId;
+ }
+
+ public SiteLoadBalancerConfig(String gslbProviderPublicIP, String gslbProviderPrivateIp, boolean local,
+ boolean revoked, String serviceType, String servicePublicIp, String port,
+ long dataCenterId) {
+ this(revoked, serviceType, servicePublicIp, port, dataCenterId);
+ this.gslbProviderPrivateIp = gslbProviderPrivateIp;
+ this.gslbProviderPublicIp = gslbProviderPublicIP;
+ this.local = local;
+ }
+
+ public String getServiceType() {
+ return serviceType;
+ }
+
+ public void setServiceType(String serviceType) {
+ this.serviceType = serviceType;
+ }
+
+ public String getServicePublicIp() {
+ return servicePublicIp;
+ }
+
+ public void SetServicePublicIp(String servicePublicIp) {
+ this.servicePublicIp = servicePublicIp;
+ }
+
+ public String getServicePort() {
+ return servicePort;
+ }
+
+ public void setServicePort(String port) {
+ this.servicePort = port;
+ }
+
+ public String getGslbProviderPrivateIp() {
+ return gslbProviderPrivateIp;
+ }
+
+ public void setGslbProviderPrivateIp(String privateIp) {
+ this.gslbProviderPrivateIp = privateIp;
+ }
+
+ public String getGslbProviderPublicIp() {
+ return gslbProviderPublicIp;
+ }
+
+ public long getDataCenterId() {
+ return dataCenterId;
+ }
+
+ public void setGslbProviderPublicIp(String publicIp) {
+ this.gslbProviderPublicIp = publicIp;
+ }
+
+ public boolean isLocal() {
+ return local;
+ }
+
+ public void setLocal(boolean local) {
+ this.local = local;
+ }
+
+ public boolean forRevoke() {
+ return revoked;
+ }
+}
\ No newline at end of file
diff --git a/api/src/com/cloud/agent/api/storage/CreateEntityDownloadURLCommand.java b/api/src/com/cloud/agent/api/storage/CreateEntityDownloadURLCommand.java
index c80179a05..d928e0c5b 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 efb5ecb52..c6ffe45a9 100644
--- a/api/src/com/cloud/agent/api/storage/DownloadCommand.java
+++ b/api/src/com/cloud/agent/api/storage/DownloadCommand.java
@@ -18,10 +18,11 @@
import java.net.URI;
-import com.cloud.storage.Volume;
+import org.apache.cloudstack.api.InternalIdentity;
+
import com.cloud.storage.Storage.ImageFormat;
+import com.cloud.storage.Volume;
import com.cloud.template.VirtualMachineTemplate;
-import org.apache.cloudstack.api.InternalIdentity;
public class DownloadCommand extends AbstractDownloadCommand implements InternalIdentity {
diff --git a/api/src/com/cloud/agent/api/storage/ListTemplateAnswer.java b/api/src/com/cloud/agent/api/storage/ListTemplateAnswer.java
index 06e95fe42..a4e2e2550 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 @@
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 a2776c2af..63c5b621c 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 b45004159..8d955bb1c 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/api/src/com/cloud/agent/api/storage/ResizeVolumeCommand.java b/api/src/com/cloud/agent/api/storage/ResizeVolumeCommand.java
index 8af23a0ab..82d3ae7b4 100644
--- a/api/src/com/cloud/agent/api/storage/ResizeVolumeCommand.java
+++ b/api/src/com/cloud/agent/api/storage/ResizeVolumeCommand.java
@@ -18,7 +18,6 @@
import com.cloud.agent.api.Command;
import com.cloud.agent.api.to.StorageFilerTO;
-import com.cloud.storage.StoragePool;
public class ResizeVolumeCommand extends Command {
private String path;
diff --git a/api/src/com/cloud/agent/api/storage/UploadCommand.java b/api/src/com/cloud/agent/api/storage/UploadCommand.java
index 2a7c60a51..473bd5b75 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 38de8d0b4..f296aa4d1 100644
--- a/api/src/com/cloud/agent/api/to/FirewallRuleTO.java
+++ b/api/src/com/cloud/agent/api/to/FirewallRuleTO.java
@@ -19,10 +19,12 @@
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.network.rules.FirewallRule.TrafficType;
import com.cloud.utils.net.NetUtils;
-import org.apache.cloudstack.api.InternalIdentity;
/**
* FirewallRuleTO transfers a port range for an ip to be opened.
@@ -94,7 +96,7 @@ public FirewallRuleTO(FirewallRule rule, String srcVlanTag, String srcIp) {
public FirewallRuleTO(FirewallRule rule, String srcIp) {
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());
}
@@ -108,6 +110,11 @@ public FirewallRuleTO(FirewallRule rule, String srcVlanTag, String srcIp, Firewa
this(rule.getId(),srcVlanTag, srcIp, rule.getProtocol(), rule.getSourcePortStart(), rule.getSourcePortEnd(), revokeState, alreadyAdded, purpose,rule.getSourceCidrList(),rule.getIcmpType(),rule.getIcmpCode());
}
+ public FirewallRuleTO(FirewallRule rule, String guestVlanTag, FirewallRule.TrafficType trafficType) {
+ this(rule.getId(), guestVlanTag, null, rule.getProtocol(), rule.getSourcePortStart(), rule.getSourcePortEnd(), rule.getState()==State.Revoke, rule.getState()==State.Active, rule.getPurpose(), rule.getSourceCidrList(), rule.getIcmpType(), rule.getIcmpCode());
+ this.trafficType = trafficType;
+ }
+
public FirewallRule.TrafficType getTrafficType(){
return trafficType;
}
diff --git a/api/src/com/cloud/agent/api/to/LoadBalancerTO.java b/api/src/com/cloud/agent/api/to/LoadBalancerTO.java
index 2d166ea1e..df2f8a874 100644
--- a/api/src/com/cloud/agent/api/to/LoadBalancerTO.java
+++ b/api/src/com/cloud/agent/api/to/LoadBalancerTO.java
@@ -31,6 +31,7 @@
import com.cloud.network.lb.LoadBalancingRule.LbAutoScaleVmProfile;
import com.cloud.network.lb.LoadBalancingRule.LbCondition;
import com.cloud.network.lb.LoadBalancingRule.LbDestination;
+import com.cloud.network.lb.LoadBalancingRule.LbHealthCheckPolicy;
import com.cloud.network.lb.LoadBalancingRule.LbStickinessPolicy;
import com.cloud.utils.Pair;
@@ -46,8 +47,10 @@ public class LoadBalancerTO {
boolean inline;
DestinationTO[] destinations;
private StickinessPolicyTO[] stickinessPolicies;
+ private HealthCheckPolicyTO[] healthCheckPolicies;
private AutoScaleVmGroupTO autoScaleVmGroupTO;
final static int MAX_STICKINESS_POLICIES = 1;
+ final static int MAX_HEALTHCHECK_POLICIES = 1;
public LoadBalancerTO(String uuid, String srcIp, int srcPort, String protocol, String algorithm, boolean revoked, boolean alreadyAdded, boolean inline, List destinations) {
if (destinations == null) { // for autoscaleconfig destinations will be null;
@@ -69,23 +72,52 @@ public LoadBalancerTO(String uuid, String srcIp, int srcPort, String protocol, S
}
}
- public LoadBalancerTO(String id, String srcIp, int srcPort, String protocol, String algorithm, boolean revoked, boolean alreadyAdded, boolean inline, List arg_destinations, List stickinessPolicies) {
+ public LoadBalancerTO(String id, String srcIp, int srcPort, String protocol, String algorithm, boolean revoked,
+ boolean alreadyAdded, boolean inline, List arg_destinations,
+ List stickinessPolicies) {
+
+ this(id, srcIp, srcPort, protocol, algorithm, revoked, alreadyAdded, inline, arg_destinations,
+ stickinessPolicies, null);
+ }
+
+ public LoadBalancerTO(String id, String srcIp, int srcPort, String protocol, String algorithm, boolean revoked,
+ boolean alreadyAdded, boolean inline, List arg_destinations,
+ List stickinessPolicies, List healthCheckPolicies) {
this(id, srcIp, srcPort, protocol, algorithm, revoked, alreadyAdded, inline, arg_destinations);
this.stickinessPolicies = null;
+ this.healthCheckPolicies = null;
if (stickinessPolicies != null && stickinessPolicies.size() > 0) {
this.stickinessPolicies = new StickinessPolicyTO[MAX_STICKINESS_POLICIES];
int index = 0;
for (LbStickinessPolicy stickinesspolicy : stickinessPolicies) {
if (!stickinesspolicy.isRevoked()) {
- this.stickinessPolicies[index] = new StickinessPolicyTO(stickinesspolicy.getMethodName(), stickinesspolicy.getParams());
+ this.stickinessPolicies[index] = new StickinessPolicyTO(stickinesspolicy.getMethodName(),
+ stickinesspolicy.getParams());
index++;
- if (index == MAX_STICKINESS_POLICIES) break;
- }
+ if (index == MAX_STICKINESS_POLICIES)
+ break;
}
- if (index == 0) this.stickinessPolicies = null;
}
+ if (index == 0)
+ this.stickinessPolicies = null;
+ }
+
+ if (healthCheckPolicies != null && healthCheckPolicies.size() > 0) {
+ this.healthCheckPolicies = new HealthCheckPolicyTO[MAX_HEALTHCHECK_POLICIES];
+ int index = 0;
+ for (LbHealthCheckPolicy hcp : healthCheckPolicies) {
+ this.healthCheckPolicies[0] = new HealthCheckPolicyTO(hcp.getpingpath(), hcp.getDescription(),
+ hcp.getResponseTime(), hcp.getHealthcheckInterval(), hcp.getHealthcheckThresshold(),
+ hcp.getUnhealthThresshold(), hcp.isRevoked());
+ index++;
+ if (index == MAX_HEALTHCHECK_POLICIES)
+ break;
}
+ if (index == 0)
+ this.healthCheckPolicies = null;
+ }
+ }
protected LoadBalancerTO() {
}
@@ -126,6 +158,10 @@ public StickinessPolicyTO[] getStickinessPolicies() {
return stickinessPolicies;
}
+ public HealthCheckPolicyTO[] getHealthCheckPolicies() {
+ return healthCheckPolicies;
+ }
+
public DestinationTO[] getDestinations() {
return destinations;
}
@@ -158,6 +194,65 @@ public StickinessPolicyTO(String methodName, List> paramsLi
this._methodName = methodName;
this._paramsList = paramsList;
}
+ }
+
+ public static class HealthCheckPolicyTO {
+ private String pingPath;
+ private String description;
+ private int responseTime;
+ private int healthcheckInterval;
+ private int healthcheckThresshold;
+ private int unhealthThresshold;
+ private boolean revoke = false;
+
+ public HealthCheckPolicyTO(String pingPath, String description, int responseTime, int healthcheckInterval,
+ int healthcheckThresshold, int unhealthThresshold, boolean revoke) {
+
+ this.description = description;
+ this.pingPath = pingPath;
+ this.responseTime = responseTime;
+ this.healthcheckInterval = healthcheckInterval;
+ this.healthcheckThresshold = healthcheckThresshold;
+ this.unhealthThresshold = unhealthThresshold;
+ this.revoke = revoke;
+ }
+
+ public HealthCheckPolicyTO() {
+
+ }
+
+ public String getpingPath() {
+ return pingPath;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public int getResponseTime() {
+ return responseTime;
+ }
+
+ public int getHealthcheckInterval() {
+ return healthcheckInterval;
+ }
+
+ public int getHealthcheckThresshold() {
+ return healthcheckThresshold;
+ }
+
+ public int getUnhealthThresshold() {
+ return unhealthThresshold;
+ }
+
+ public void setRevoke(boolean revoke) {
+ this.revoke = revoke;
+ }
+
+ public boolean isRevoked() {
+ return revoke;
+ }
+
}
public static class DestinationTO {
@@ -165,6 +260,7 @@ public static class DestinationTO {
int destPort;
boolean revoked;
boolean alreadyAdded;
+ String monitorState;
public DestinationTO(String destIp, int destPort, boolean revoked, boolean alreadyAdded) {
this.destIp = destIp;
this.destPort = destPort;
@@ -190,6 +286,14 @@ public boolean isRevoked() {
public boolean isAlreadyAdded() {
return alreadyAdded;
}
+
+ public void setMonitorState(String state) {
+ this.monitorState = state;
+ }
+
+ public String getMonitorState() {
+ return monitorState;
+ }
}
public static class CounterTO implements Serializable {
private final String name;
diff --git a/api/src/com/cloud/agent/api/to/NetworkACLTO.java b/api/src/com/cloud/agent/api/to/NetworkACLTO.java
index 9b1a6296b..8818e13de 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 @@
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/NicTO.java b/api/src/com/cloud/agent/api/to/NicTO.java
index aa2aa19cc..ccebe115f 100644
--- a/api/src/com/cloud/agent/api/to/NicTO.java
+++ b/api/src/com/cloud/agent/api/to/NicTO.java
@@ -16,12 +16,15 @@
// under the License.
package com.cloud.agent.api.to;
+import java.util.List;
+
public class NicTO extends NetworkTO {
int deviceId;
Integer networkRateMbps;
Integer networkRateMulticastMbps;
boolean defaultNic;
String uuid;
+ List nicSecIps;
public NicTO() {
super();
@@ -69,4 +72,12 @@ public void setUuid(String uuid) {
public String toString() {
return new StringBuilder("[Nic:").append(type).append("-").append(ip).append("-").append(broadcastUri).append("]").toString();
}
+
+ public void setNicSecIps(List secIps) {
+ this.nicSecIps = secIps;
+ }
+
+ public List getNicSecIps() {
+ return nicSecIps;
+ }
}
diff --git a/api/src/com/cloud/agent/api/to/S3TO.java b/api/src/com/cloud/agent/api/to/S3TO.java
index 879df229c..d556cb6d0 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 d77b80551..45fa57bf3 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 8f3f0eb39..b84d20a92 100644
--- a/api/src/com/cloud/agent/api/to/VirtualMachineTO.java
+++ b/api/src/com/cloud/agent/api/to/VirtualMachineTO.java
@@ -28,7 +28,20 @@ public class VirtualMachineTO {
private BootloaderType bootloader;
Type type;
int cpus;
+
+ /**
+ 'speed' is still here since 4.0.X/4.1.X management servers do not support
+ the overcommit feature yet.
+
+ The overcommit feature sends minSpeed and maxSpeed
+
+ So this is here for backwards compatibility with 4.0.X/4.1.X management servers
+ and newer agents.
+ */
Integer speed;
+ Integer minSpeed;
+ Integer maxSpeed;
+
long minRam;
long maxRam;
String hostName;
@@ -62,6 +75,22 @@ public VirtualMachineTO(long id, String instanceName, VirtualMachine.Type type,
this.vncPassword = 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.minSpeed = minSpeed;
+ this.maxSpeed = maxSpeed;
+ this.minRam = minRam;
+ this.maxRam = maxRam;
+ this.bootloader = bootloader;
+ this.os = os;
+ this.enableHA = enableHA;
+ this.limitCpuUse = limitCpuUse;
+ this.vncPassword = vncPassword;
+ }
+
protected VirtualMachineTO() {
}
@@ -105,6 +134,13 @@ 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 ff739c58f..4cbe82b35 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 String getChainInfo() {
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 defd15490..31768cf19 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();
@@ -30,4 +30,5 @@ public interface Alert extends Identity, InternalIdentity {
Date getCreatedDate();
Date getLastSent();
Date getResolved();
+ boolean getArchived();
}
diff --git a/api/src/com/cloud/api/commands/CreatePrivateNetworkCmd.java b/api/src/com/cloud/api/commands/CreatePrivateNetworkCmd.java
deleted file mode 100644
index 1cc20d789..000000000
--- a/api/src/com/cloud/api/commands/CreatePrivateNetworkCmd.java
+++ /dev/null
@@ -1,194 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements. See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership. The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-package com.cloud.api.commands;
-
-import org.apache.cloudstack.api.*;
-import org.apache.cloudstack.api.response.DomainResponse;
-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;
-import com.cloud.exception.ResourceAllocationException;
-import com.cloud.network.Network;
-import com.cloud.user.UserContext;
-
-//@APICommand(description="Creates a private network", responseObject=NetworkResponse.class)
-public class CreatePrivateNetworkCmd extends BaseAsyncCreateCmd {
- public static final Logger s_logger = Logger.getLogger(CreatePrivateNetworkCmd.class.getName());
-
- private static final String s_name = "createnetworkresponse";
-
- /////////////////////////////////////////////////////
- //////////////// API parameters /////////////////////
- /////////////////////////////////////////////////////
-
- @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, required=true, description="the name of the network")
- private String name;
-
- @Parameter(name=ApiConstants.DISPLAY_TEXT, type=CommandType.STRING, required=true, description="the display text of the network")
- private String displayText;
-
- @Parameter(name=ApiConstants.PHYSICAL_NETWORK_ID, type=CommandType.UUID, entityType = PhysicalNetworkResponse.class,
- required=true, description="the Physical Network ID the network belongs to")
- private Long physicalNetworkId;
-
- @Parameter(name=ApiConstants.GATEWAY, type=CommandType.STRING, required=true, description="the gateway of the network")
- private String gateway;
-
- @Parameter(name=ApiConstants.NETMASK, type=CommandType.STRING, required=true, description="the netmask of the network")
- private String netmask;
-
- @Parameter(name=ApiConstants.START_IP, type=CommandType.STRING, required=true, description="the beginning IP address in the network IP range")
- private String startIp;
-
- @Parameter(name=ApiConstants.END_IP, type=CommandType.STRING, description="the ending IP address in the network IP" +
- " range. If not specified, will be defaulted to startIP")
- private String endIp;
-
- @Parameter(name=ApiConstants.VLAN, type=CommandType.STRING, required=true, description="the ID or VID of the network")
- private String vlan;
-
- @Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, description="account who will own the network")
- private String accountName;
-
- @Parameter(name=ApiConstants.PROJECT_ID, type=CommandType.UUID, entityType = ProjectResponse.class,
- description="an optional project for the ssh key")
- private Long projectId;
-
- @Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.UUID, entityType = DomainResponse.class,
- description="domain ID of the account owning a network")
- private Long domainId;
-
-
- /////////////////////////////////////////////////////
- /////////////////// Accessors ///////////////////////
- /////////////////////////////////////////////////////
-
- public String getGateway() {
- return gateway;
- }
-
- public String getVlan() {
- return vlan;
- }
-
- public String getAccountName() {
- return accountName;
- }
-
- public Long getDomainId() {
- return domainId;
- }
-
- public String getNetmask() {
- return netmask;
- }
-
- public String getStartIp() {
- return startIp;
- }
-
- public String getNetworkName() {
- return name;
- }
-
- public String getDisplayText() {
- return displayText;
- }
-
- public Long getProjectId() {
- return projectId;
- }
-
- public long getPhysicalNetworkId() {
- return physicalNetworkId;
- }
-
- public String getEndIp() {
- return endIp;
- }
-
- /////////////////////////////////////////////////////
- /////////////// API Implementation///////////////////
- /////////////////////////////////////////////////////
- @Override
- public String getCommandName() {
- return s_name;
- }
-
-
- @Override
- public void create() throws ResourceAllocationException {
- Network result = null;
- try {
- result = _networkService.createPrivateNetwork(getNetworkName(), getDisplayText(), getPhysicalNetworkId(), getVlan(),
- getStartIp(), getEndIp(), getGateway(), getNetmask(), getEntityOwnerId(), null);
- } catch (InsufficientCapacityException ex){
- s_logger.info(ex);
- s_logger.trace(ex);
- throw new ServerApiException(ApiErrorCode.INSUFFICIENT_CAPACITY_ERROR, ex.getMessage());
- } catch (ConcurrentOperationException ex) {
- s_logger.warn("Exception: ", ex);
- throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage());
- }
-
- if (result != null) {
- this.setEntityId(result.getId());
- this.setEntityUuid(result.getUuid());
- } else {
- throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create a Private network");
- }
- }
-
- @Override
- public void execute() throws InsufficientCapacityException, ConcurrentOperationException, ResourceAllocationException{
- Network result = _networkService.getNetwork(getEntityId());
- if (result != null) {
- NetworkResponse response = _responseGenerator.createNetworkResponse(result);
- response.setResponseName(getCommandName());
- this.setResponseObject(response);
- } else {
- throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create private network");
- }
- }
-
- @Override
- public long getEntityOwnerId() {
- Long accountId = finalyzeAccountId(accountName, domainId, projectId, true);
- if (accountId == null) {
- return UserContext.current().getCaller().getId();
- }
- return accountId;
- }
-
- @Override
- public String getEventType() {
- return EventTypes.EVENT_NETWORK_CREATE;
- }
-
- @Override
- public String getEventDescription() {
- return "creating private network";
-
- }
-
-}
diff --git a/api/src/com/cloud/api/commands/DestroyConsoleProxyCmd.java b/api/src/com/cloud/api/commands/DestroyConsoleProxyCmd.java
deleted file mode 100644
index e749f2210..000000000
--- a/api/src/com/cloud/api/commands/DestroyConsoleProxyCmd.java
+++ /dev/null
@@ -1,90 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements. See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership. The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-package com.cloud.api.commands;
-
-import org.apache.cloudstack.api.*;
-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;
-
-//@APICommand(description="Destroys console proxy", responseObject=SuccessResponse.class)
-public class DestroyConsoleProxyCmd extends BaseAsyncCmd {
- public static final Logger s_logger = Logger.getLogger(DestroyConsoleProxyCmd.class.getName());
-
- private static final String s_name = "destroyconsoleproxyresponse";
-
- /////////////////////////////////////////////////////
- //////////////// API parameters /////////////////////
- /////////////////////////////////////////////////////
-
- @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="console proxy ID")
- private Long id;
-
-
- /////////////////////////////////////////////////////
- /////////////////// Accessors ///////////////////////
- /////////////////////////////////////////////////////
-
- public Long getId() {
- return id;
- }
-
-
- /////////////////////////////////////////////////////
- /////////////// API Implementation///////////////////
- /////////////////////////////////////////////////////
-
- @Override
- public String getCommandName() {
- return s_name;
- }
-
- @Override
- public long getEntityOwnerId() {
- Account 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 String getEventType() {
- return EventTypes.EVENT_PROXY_DESTROY;
- }
-
- @Override
- public String getEventDescription() {
- return "destroying console proxy: " + getId();
- }
-
- @Override
- public void execute(){
- boolean result = _consoleProxyService.destroyConsoleProxy(this);
- if (result) {
- SuccessResponse response = new SuccessResponse(getCommandName());
- this.setResponseObject(response);
- } else {
- 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 709da6af3..3efd4c5ab 100644
--- a/api/src/com/cloud/api/commands/ListRecurringSnapshotScheduleCmd.java
+++ b/api/src/com/cloud/api/commands/ListRecurringSnapshotScheduleCmd.java
@@ -19,12 +19,12 @@
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/async/AsyncJob.java b/api/src/com/cloud/async/AsyncJob.java
index 034c853e8..866429b65 100644
--- a/api/src/com/cloud/async/AsyncJob.java
+++ b/api/src/com/cloud/async/AsyncJob.java
@@ -16,11 +16,11 @@
// under the License.
package com.cloud.async;
-import java.util.Date;
-
import org.apache.cloudstack.api.Identity;
import org.apache.cloudstack.api.InternalIdentity;
+import java.util.Date;
+
public interface AsyncJob extends Identity, InternalIdentity {
public enum Type {
None,
@@ -48,7 +48,9 @@ public enum Type {
Condition,
AutoScalePolicy,
AutoScaleVmProfile,
- AutoScaleVmGroup
+ AutoScaleVmGroup,
+ GlobalLoadBalancerRule,
+ AffinityGroup
}
long getUserId();
diff --git a/api/src/com/cloud/configuration/ConfigurationService.java b/api/src/com/cloud/configuration/ConfigurationService.java
index 48a060719..6937d0b64 100644
--- a/api/src/com/cloud/configuration/ConfigurationService.java
+++ b/api/src/com/cloud/configuration/ConfigurationService.java
@@ -20,24 +20,29 @@
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.DedicatePublicIpRangeCmd;
import org.apache.cloudstack.api.command.admin.vlan.DeleteVlanIpRangeCmd;
+import org.apache.cloudstack.api.command.admin.vlan.ReleasePublicIpRangeCmd;
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;
@@ -231,6 +236,10 @@ public interface ConfigurationService {
boolean deleteVlanIpRange(DeleteVlanIpRangeCmd cmd);
+ Vlan dedicatePublicIpRange(DedicatePublicIpRangeCmd cmd) throws ResourceAllocationException;
+
+ boolean releasePublicIpRange(ReleasePublicIpRangeCmd cmd);
+
NetworkOffering createNetworkOffering(CreateNetworkOfferingCmd cmd);
NetworkOffering updateNetworkOffering(UpdateNetworkOfferingCmd cmd);
@@ -261,6 +270,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 7f551d6b5..5550e29ec 100644
--- a/api/src/com/cloud/configuration/Resource.java
+++ b/api/src/com/cloud/configuration/Resource.java
@@ -20,7 +20,7 @@ public interface Resource {
public static final short RESOURCE_UNLIMITED = -1;
- public enum ResourceType {
+ public enum ResourceType { // Primary and Secondary storage are allocated_storage and not the physical storage.
user_vm("user_vm", 0, ResourceOwnerType.Account, ResourceOwnerType.Domain),
public_ip("public_ip", 1, ResourceOwnerType.Account, ResourceOwnerType.Domain),
volume("volume", 2, ResourceOwnerType.Account, ResourceOwnerType.Domain),
@@ -28,11 +28,16 @@ public enum ResourceType {
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),
+ primary_storage("primary_storage", 10, ResourceOwnerType.Account, ResourceOwnerType.Domain),
+ secondary_storage("secondary_storage", 11, ResourceOwnerType.Account, ResourceOwnerType.Domain);
private String name;
private ResourceOwnerType[] supportedOwners;
private int ordinal;
+ public static final long bytesToGiB = 1024 * 1024 * 1024;
ResourceType(String name, int ordinal, ResourceOwnerType... supportedOwners) {
this.name = name;
diff --git a/api/src/com/cloud/dao/EntityManager.java b/api/src/com/cloud/dao/EntityManager.java
index b8fdaa7e9..8e6a438d0 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
diff --git a/api/src/com/cloud/dc/DataCenter.java b/api/src/com/cloud/dc/DataCenter.java
index 946e9ccb5..5f32988da 100644
--- a/api/src/com/cloud/dc/DataCenter.java
+++ b/api/src/com/cloud/dc/DataCenter.java
@@ -18,11 +18,12 @@
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 enum NetworkType {
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 9da5b7e78..1cbab36f3 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/domain/Domain.java b/api/src/com/cloud/domain/Domain.java
index cfed519ad..befed0730 100644
--- a/api/src/com/cloud/domain/Domain.java
+++ b/api/src/com/cloud/domain/Domain.java
@@ -18,10 +18,11 @@
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,7 @@ enum State {
void setState(State state);
String getNetworkDomain();
+
+ public String getUuid();
+
}
diff --git a/api/src/com/cloud/event/Event.java b/api/src/com/cloud/event/Event.java
index 1a6163682..b8def4c62 100644
--- a/api/src/com/cloud/event/Event.java
+++ b/api/src/com/cloud/event/Event.java
@@ -40,4 +40,5 @@ public enum State {
String getLevel();
long getStartId();
String getParameters();
+ boolean getArchived();
}
diff --git a/api/src/com/cloud/event/EventTypes.java b/api/src/com/cloud/event/EventTypes.java
index 0dd97cb43..0ee7f402f 100755
--- a/api/src/com/cloud/event/EventTypes.java
+++ b/api/src/com/cloud/event/EventTypes.java
@@ -59,6 +59,7 @@ public class EventTypes {
public static final String EVENT_VM_REBOOT = "VM.REBOOT";
public static final String EVENT_VM_UPDATE = "VM.UPDATE";
public static final String EVENT_VM_UPGRADE = "VM.UPGRADE";
+ public static final String EVENT_VM_SCALE = "VM.SCALE";
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";
@@ -110,12 +111,22 @@ public class EventTypes {
public static final String EVENT_LOAD_BALANCER_DELETE = "LB.DELETE";
public static final String EVENT_LB_STICKINESSPOLICY_CREATE = "LB.STICKINESSPOLICY.CREATE";
public static final String EVENT_LB_STICKINESSPOLICY_DELETE = "LB.STICKINESSPOLICY.DELETE";
+ public static final String EVENT_LB_HEALTHCHECKPOLICY_CREATE = "LB.HEALTHCHECKPOLICY.CREATE";
+ public static final String EVENT_LB_HEALTHCHECKPOLICY_DELETE = "LB.HEALTHCHECKPOLICY.DELETE";
public static final String EVENT_LOAD_BALANCER_UPDATE = "LB.UPDATE";
+ // Global Load Balancer rules
+ public static final String EVENT_ASSIGN_TO_GLOBAL_LOAD_BALANCER_RULE = "GLOBAL.LB.ASSIGN";
+ public static final String EVENT_REMOVE_FROM_GLOBAL_LOAD_BALANCER_RULE = "GLOBAL.LB.REMOVE";
+ public static final String EVENT_GLOBAL_LOAD_BALANCER_CREATE = "GLOBAL.LB.CREATE";
+ public static final String EVENT_GLOBAL_LOAD_BALANCER_DELETE = "GLOBAL.LB.DELETE";
+
// Account events
+ public static final String EVENT_ACCOUNT_ENABLE = "ACCOUNT.ENABLE";
public static final String EVENT_ACCOUNT_DISABLE = "ACCOUNT.DISABLE";
public static final String EVENT_ACCOUNT_CREATE = "ACCOUNT.CREATE";
public static final String EVENT_ACCOUNT_DELETE = "ACCOUNT.DELETE";
+ public static final String EVENT_ACCOUNT_UPDATE = "ACCOUNT.UPDATE";
public static final String EVENT_ACCOUNT_MARK_DEFAULT_ZONE = "ACCOUNT.MARK.DEFAULT.ZONE";
// UserVO Events
@@ -128,6 +139,12 @@ public class EventTypes {
public static final String EVENT_USER_ENABLE = "USER.ENABLE";
public static final String EVENT_USER_LOCK = "USER.LOCK";
+ //registering SSH keypair events
+ public static final String EVENT_REGISTER_SSH_KEYPAIR = "REGISTER.SSH.KEYPAIR";
+
+ //register for user API and secret keys
+ public static final String EVENT_REGISTER_FOR_SECRET_API_KEY = "REGISTER.USER.KEY";
+
// Template Events
public static final String EVENT_TEMPLATE_CREATE = "TEMPLATE.CREATE";
public static final String EVENT_TEMPLATE_DELETE = "TEMPLATE.DELETE";
@@ -209,6 +226,8 @@ public class EventTypes {
// VLANs/IP ranges
public static final String EVENT_VLAN_IP_RANGE_CREATE = "VLAN.IP.RANGE.CREATE";
public static final String EVENT_VLAN_IP_RANGE_DELETE = "VLAN.IP.RANGE.DELETE";
+ public static final String EVENT_VLAN_IP_RANGE_DEDICATE = "VLAN.IP.RANGE.DEDICATE";
+ public static final String EVENT_VLAN_IP_RANGE_RELEASE = "VLAN.IP.RANGE.RELEASE";
public static final String EVENT_STORAGE_IP_RANGE_CREATE = "STORAGE.IP.RANGE.CREATE";
public static final String EVENT_STORAGE_IP_RANGE_DELETE = "STORAGE.IP.RANGE.DELETE";
@@ -332,6 +351,11 @@ public class EventTypes {
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";
public static final String EVENT_EXTERNAL_NVP_CONTROLLER_DELETE = "PHYSICAL.NVPCONTROLLER.DELETE";
@@ -360,6 +384,12 @@ public class EventTypes {
public static final String EVENT_BAREMETAL_PXE_SERVER_ADD = "PHYSICAL.PXE.ADD";
public static final String EVENT_BAREMETAL_PXE_SERVER_DELETE = "PHYSICAL.PXE.DELETE";
+ public static final String EVENT_AFFINITY_GROUP_CREATE = "AG.CREATE";
+ public static final String EVENT_AFFINITY_GROUP_DELETE = "AG.DELETE";
+ public static final String EVENT_AFFINITY_GROUP_ASSIGN = "AG.ASSIGN";
+ public static final String EVENT_AFFINITY_GROUP_REMOVE = "AG.REMOVE";
+ public static final String EVENT_VM_AFFINITY_GROUP_UPDATE = "VM.AG.UPDATE";
+
static {
// TODO: need a way to force author adding event types to declare the entity details as well, with out braking
@@ -517,6 +547,8 @@ public class EventTypes {
// 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_VLAN_IP_RANGE_DEDICATE, Vlan.class.getName());
+ entityEventDetails.put(EVENT_VLAN_IP_RANGE_RELEASE,Vlan.class.getName());
entityEventDetails.put(EVENT_STORAGE_IP_RANGE_CREATE, StorageNetworkIpRange.class.getName());
entityEventDetails.put(EVENT_STORAGE_IP_RANGE_DELETE, StorageNetworkIpRange.class.getName());
diff --git a/api/src/com/cloud/exception/AffinityConflictException.java b/api/src/com/cloud/exception/AffinityConflictException.java
new file mode 100644
index 000000000..8b187783f
--- /dev/null
+++ b/api/src/com/cloud/exception/AffinityConflictException.java
@@ -0,0 +1,34 @@
+// 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;
+
+public class AffinityConflictException extends CloudRuntimeException {
+
+ private static final long serialVersionUID = SerialVersionUID.AffinityConflictException;
+
+ public AffinityConflictException(String message) {
+ super(message);
+ }
+
+ public AffinityConflictException(String message, Throwable th) {
+ super(message, th);
+ }
+
+}
diff --git a/api/src/com/cloud/exception/CloudException.java b/api/src/com/cloud/exception/CloudException.java
index 732670288..0b71ce89a 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;
/**
diff --git a/api/src/com/cloud/exception/PermissionDeniedException.java b/api/src/com/cloud/exception/PermissionDeniedException.java
index 638b762d4..718de0df7 100644
--- a/api/src/com/cloud/exception/PermissionDeniedException.java
+++ b/api/src/com/cloud/exception/PermissionDeniedException.java
@@ -19,6 +19,7 @@
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;
@@ -31,6 +32,10 @@ public PermissionDeniedException(String message) {
super(message);
}
+ public PermissionDeniedException(String message, Throwable cause){
+ super(message, cause);
+ }
+
protected PermissionDeniedException() {
super();
}
diff --git a/api/src/com/cloud/exception/RequestLimitException.java b/api/src/com/cloud/exception/RequestLimitException.java
index 0142f8e87..4d7504ed6 100644
--- a/api/src/com/cloud/exception/RequestLimitException.java
+++ b/api/src/com/cloud/exception/RequestLimitException.java
@@ -17,14 +17,12 @@
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.
- * @author minc
*
*/
-public class RequestLimitException extends CloudRuntimeException {
+public class RequestLimitException extends PermissionDeniedException {
private static final long serialVersionUID = SerialVersionUID.AccountLimitException;
diff --git a/api/src/com/cloud/host/Host.java b/api/src/com/cloud/host/Host.java
index 7236680fd..17b0ba86f 100755
--- a/api/src/com/cloud/host/Host.java
+++ b/api/src/com/cloud/host/Host.java
@@ -18,11 +18,12 @@
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;
/**
diff --git a/api/src/com/cloud/hypervisor/Hypervisor.java b/api/src/com/cloud/hypervisor/Hypervisor.java
index 2e0012dca..a4ee5b98f 100644
--- a/api/src/com/cloud/hypervisor/Hypervisor.java
+++ b/api/src/com/cloud/hypervisor/Hypervisor.java
@@ -29,6 +29,7 @@ public static enum HypervisorType {
BareMetal,
Simulator,
Ovm,
+ LXC,
Any; /*If you don't care about the hypervisor type*/
@@ -54,6 +55,8 @@ public static HypervisorType getType(String hypervisor) {
return HypervisorType.Simulator;
} else if (hypervisor.equalsIgnoreCase("Ovm")) {
return HypervisorType.Ovm;
+ } else if (hypervisor.equalsIgnoreCase("LXC")) {
+ return HypervisorType.LXC;
} else if (hypervisor.equalsIgnoreCase("Any")) {
return HypervisorType.Any;
} else {
diff --git a/api/src/com/cloud/hypervisor/HypervisorCapabilities.java b/api/src/com/cloud/hypervisor/HypervisorCapabilities.java
index efb8a6a20..aff81b001 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 0ac7f500e..fce8f38c2 100644
--- a/api/src/com/cloud/network/IpAddress.java
+++ b/api/src/com/cloud/network/IpAddress.java
@@ -19,10 +19,11 @@
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
@@ -86,4 +87,7 @@ enum Purpose {
* @param vpcId
*/
void setVpcId(Long vpcId);
+ String getVmIp();
+ void setVmIp(String vmIp);
+
}
diff --git a/api/src/com/cloud/network/Network.java b/api/src/com/cloud/network/Network.java
index a70bf02b2..ffe70d19d 100644
--- a/api/src/com/cloud/network/Network.java
+++ b/api/src/com/cloud/network/Network.java
@@ -16,11 +16,24 @@
// 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.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;
@@ -34,7 +47,7 @@
*/
public interface Network extends ControlledEntity, StateObject, InternalIdentity, Identity {
- public enum GuestType {
+ public enum GuestType {
Shared,
Isolated
}
@@ -46,7 +59,7 @@ public static class Service {
public static final Service Dhcp = new Service("Dhcp");
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,
+ public static final Service Firewall = new Service("Firewall", Capability.SupportedProtocols,
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,
@@ -122,8 +135,9 @@ public static class Provider {
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);
- public static final Provider MidokuraMidonet = new Provider("MidokuraMidonet", 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 CiscoVnmc = new Provider("CiscoVnmc", true);
private String name;
private boolean isExternal;
@@ -174,6 +188,7 @@ public static class Capability {
public static final Capability InlineMode = new Capability("InlineMode");
public static final Capability SupportedTrafficDirection = new Capability("SupportedTrafficDirection");
public static final Capability SupportedEgressProtocols = new Capability("SupportedEgressProtocols");
+ public static final Capability HealthCheckPolicy = new Capability("HealthCheckPolicy");
private String name;
@@ -221,6 +236,8 @@ public enum State {
s_fsm.addTransition(State.Implemented, Event.DestroyNetwork, State.Shutdown);
s_fsm.addTransition(State.Shutdown, Event.OperationSucceeded, State.Allocated);
s_fsm.addTransition(State.Shutdown, Event.OperationFailed, State.Implemented);
+ s_fsm.addTransition(State.Setup, Event.DestroyNetwork, State.Destroy);
+ s_fsm.addTransition(State.Allocated, Event.DestroyNetwork, State.Destroy);
}
public static StateMachine2 getStateMachine() {
@@ -232,7 +249,7 @@ private State(String description) {
_description = description;
}
}
-
+
public class IpAddresses {
private String ip4Address;
private String ip6Address;
@@ -269,12 +286,21 @@ public void setIp6Address(String ip6Address) {
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();
diff --git a/api/src/com/cloud/network/NetworkModel.java b/api/src/com/cloud/network/NetworkModel.java
index 7e17405f4..4d7d714a7 100644
--- a/api/src/com/cloud/network/NetworkModel.java
+++ b/api/src/com/cloud/network/NetworkModel.java
@@ -24,6 +24,7 @@
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;
@@ -249,5 +250,17 @@ Map> getIpToServices(List extends PublicIpAddres
boolean isNetworkInlineMode(Network network);
- Vlan getVlanForNetwork(long networkId);
+ 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;
+
+ String getStartIpv6Address(long id);
+
+ boolean isProviderEnabledInZone(long zoneId, String provider);
+
+ Nic getPlaceholderNicForRouter(Network network, Long podId);
}
\ 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 e3be941f4..2f5664513 100644
--- a/api/src/com/cloud/network/NetworkProfile.java
+++ b/api/src/com/cloud/network/NetworkProfile.java
@@ -21,7 +21,6 @@
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,7 @@ 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;
@@ -66,6 +66,7 @@ public NetworkProfile(Network 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();
@@ -163,6 +164,11 @@ public String getCidr() {
return cidr;
}
+ @Override
+ public String getNetworkCidr() {
+ return networkCidr;
+ }
+
@Override
public long getNetworkOfferingId() {
return networkOfferingId;
diff --git a/api/src/com/cloud/network/NetworkService.java b/api/src/com/cloud/network/NetworkService.java
index 786afb1e1..066009b8b 100755
--- a/api/src/com/cloud/network/NetworkService.java
+++ b/api/src/com/cloud/network/NetworkService.java
@@ -22,6 +22,8 @@
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.vm.ListNicsCmd;
+
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientAddressCapacityException;
import com.cloud.exception.InsufficientCapacityException;
@@ -32,6 +34,8 @@
import com.cloud.user.Account;
import com.cloud.user.User;
import com.cloud.utils.Pair;
+import com.cloud.vm.Nic;
+import com.cloud.vm.NicSecondaryIp;
/**
* The NetworkService interface is the "public" api to entities that make requests to the orchestration engine
@@ -42,7 +46,7 @@ public interface NetworkService {
List extends Network> getIsolatedNetworksOwnedByAccountInZone(long zoneId, Account owner);
- IpAddress allocateIP(Account ipOwner, boolean isSystem, long zoneId) throws ResourceAllocationException,
+ IpAddress allocateIP(Account ipOwner, long zoneId, Long networkId) throws ResourceAllocationException,
InsufficientAddressCapacityException, ConcurrentOperationException;
boolean releaseIpAddress(long ipAddressId) throws InsufficientAddressCapacityException;
@@ -65,10 +69,8 @@ boolean restartNetwork(RestartNetworkCmd cmd, boolean cleanup) throws Concurrent
IpAddress getIp(long id);
-
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);
PhysicalNetwork createPhysicalNetwork(Long zoneId, String vnetRange, String networkSpeed,
List isolationMethods, String broadcastDomainRange, Long domainId, List tags, String name);
@@ -154,5 +156,13 @@ IpAddress associateIPToNetwork(long ipId, long networkId) throws InsufficientAdd
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;
-
+
+ /* Requests an IP address for the guest nic */
+ String allocateSecondaryGuestIP(Account account, long zoneId, Long nicId,
+ Long networkId, String ipaddress) throws InsufficientAddressCapacityException;
+
+ boolean releaseSecondaryIpFromNic(long ipAddressId);
+
+ /* lists the nic informaton */
+ List extends Nic> listNics(ListNicsCmd listNicsCmd);
}
diff --git a/api/src/com/cloud/network/NetworkUsageService.java b/api/src/com/cloud/network/NetworkUsageService.java
new file mode 100644
index 000000000..1cfea24d0
--- /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 e3d21584a..f085e9f30 100755
--- a/api/src/com/cloud/network/Networks.java
+++ b/api/src/com/cloud/network/Networks.java
@@ -62,6 +62,7 @@ public enum BroadcastDomainType {
Vnet("vnet", Long.class),
Storage("storage", Integer.class),
Lswitch("lswitch", String.class),
+ Mido("mido", String.class),
UnDecided(null, null);
private String scheme;
diff --git a/api/src/com/cloud/network/PhysicalNetwork.java b/api/src/com/cloud/network/PhysicalNetwork.java
index a49509287..a2044a610 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,9 @@ public enum IsolationMethod {
VLAN,
L3,
GRE,
- STT;
+ STT,
+ VNS,
+ MIDO;
}
public enum BroadcastDomainRange {
diff --git a/api/src/com/cloud/network/PhysicalNetworkServiceProvider.java b/api/src/com/cloud/network/PhysicalNetworkServiceProvider.java
index 0a433dcbc..d67c3c7b1 100644
--- a/api/src/com/cloud/network/PhysicalNetworkServiceProvider.java
+++ b/api/src/com/cloud/network/PhysicalNetworkServiceProvider.java
@@ -18,9 +18,10 @@
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 62400e80a..a385b533a 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 21dae5420..d81e9c1ee 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/RemoteAccessVpn.java b/api/src/com/cloud/network/RemoteAccessVpn.java
index 1b463309a..058b2f486 100644
--- a/api/src/com/cloud/network/RemoteAccessVpn.java
+++ b/api/src/com/cloud/network/RemoteAccessVpn.java
@@ -17,8 +17,10 @@
package com.cloud.network;
import org.apache.cloudstack.acl.ControlledEntity;
+import org.apache.cloudstack.api.Identity;
+import org.apache.cloudstack.api.InternalIdentity;
-public interface RemoteAccessVpn extends ControlledEntity {
+public interface RemoteAccessVpn extends ControlledEntity, InternalIdentity, Identity {
enum State {
Added,
Running,
diff --git a/api/src/com/cloud/network/StorageNetworkService.java b/api/src/com/cloud/network/StorageNetworkService.java
index 1bda24717..5aae0ca96 100755
--- a/api/src/com/cloud/network/StorageNetworkService.java
+++ b/api/src/com/cloud/network/StorageNetworkService.java
@@ -19,11 +19,12 @@
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.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;
-import org.apache.cloudstack.api.command.admin.network.CreateStorageNetworkIpRangeCmd;
public interface StorageNetworkService {
StorageNetworkIpRange createIpRange(CreateStorageNetworkIpRangeCmd cmd) throws SQLException;
diff --git a/api/src/com/cloud/network/TrafficLabel.java b/api/src/com/cloud/network/TrafficLabel.java
new file mode 100644
index 000000000..782df14b7
--- /dev/null
+++ b/api/src/com/cloud/network/TrafficLabel.java
@@ -0,0 +1,36 @@
+// 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 com.cloud.network.Networks.TrafficType;
+
+/* User can provide a Label, while configuring a zone, to specify
+ * a physical network that is to be used for a traffic type defined
+ * by CloudStack. See the enum data type TrafficType. This label is
+ * called Traffic label. This might encapsulate physical network
+ * specific properties like VLAN ID, name of virtual network object or more.
+ * The name of virtual network object is dependent on type of hypervisor.
+ * For example it is name of xenserver bridge in case of XenServer and
+ * name of virtual switch in case of VMware hypervisor
+ */
+public interface TrafficLabel {
+
+ public TrafficType getTrafficType();
+
+ public String getNetworkLabel();
+
+}
diff --git a/api/src/com/cloud/network/VirtualNetworkApplianceService.java b/api/src/com/cloud/network/VirtualNetworkApplianceService.java
index 7b553b29a..250ecb24e 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 daa8d1913..32d693d7b 100644
--- a/api/src/com/cloud/network/as/AutoScaleService.java
+++ b/api/src/com/cloud/network/as/AutoScaleService.java
@@ -19,11 +19,19 @@
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 3be5a3e81..9c6a0f2f4 100644
--- a/api/src/com/cloud/network/as/AutoScaleVmProfile.java
+++ b/api/src/com/cloud/network/as/AutoScaleVmProfile.java
@@ -20,9 +20,10 @@
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/LoadBalancingServiceProvider.java b/api/src/com/cloud/network/element/LoadBalancingServiceProvider.java
index 879ea0ed6..cb3155f9c 100644
--- a/api/src/com/cloud/network/element/LoadBalancingServiceProvider.java
+++ b/api/src/com/cloud/network/element/LoadBalancingServiceProvider.java
@@ -18,6 +18,7 @@
import java.util.List;
+import com.cloud.agent.api.to.LoadBalancerTO;
import com.cloud.exception.ResourceUnavailableException;
import com.cloud.network.Network;
import com.cloud.network.lb.LoadBalancingRule;
@@ -25,6 +26,7 @@
public interface LoadBalancingServiceProvider extends NetworkElement, IpDeployingRequester {
/**
* Apply rules
+ *
* @param network
* @param rules
* @return
@@ -34,10 +36,14 @@ public interface LoadBalancingServiceProvider extends NetworkElement, IpDeployin
/**
* Validate rules
+ *
* @param network
* @param rule
- * @return true/false. true should be return if there are no validations. false should be return if any oneof the validation fails.
+ * @return true/false. true should be return if there are no validations.
+ *false should be return if any oneof the validation fails.
* @throws
*/
boolean validateLBRule(Network network, LoadBalancingRule rule);
+
+ List updateHealthChecks(Network network, List lbrules);
}
diff --git a/api/src/com/cloud/network/element/NetworkElement.java b/api/src/com/cloud/network/element/NetworkElement.java
index 1ddd60b27..d89c2a3c4 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 @@ boolean implement(Network network, NetworkOffering offering, DeployDestination d
* @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 @@ boolean prepare(Network network, NicProfile nic, VirtualMachineProfile extends
* @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 @@ boolean release(Network network, NicProfile nic, VirtualMachineProfile extends
* @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 @@ boolean shutdown(Network network, ReservationContext context, boolean cleanup)
* @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/VirtualRouterElementService.java b/api/src/com/cloud/network/element/VirtualRouterElementService.java
index 3ba2045cf..ea971b89c 100644
--- a/api/src/com/cloud/network/element/VirtualRouterElementService.java
+++ b/api/src/com/cloud/network/element/VirtualRouterElementService.java
@@ -20,6 +20,7 @@
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 482fe6245..81b1cf321 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.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 419cc6a1b..179e9f7ae 100644
--- a/api/src/com/cloud/network/firewall/FirewallService.java
+++ b/api/src/com/cloud/network/firewall/FirewallService.java
@@ -20,6 +20,7 @@
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;
diff --git a/api/src/com/cloud/network/firewall/NetworkACLService.java b/api/src/com/cloud/network/firewall/NetworkACLService.java
index a1fb02cb7..97de496f6 100644
--- a/api/src/com/cloud/network/firewall/NetworkACLService.java
+++ b/api/src/com/cloud/network/firewall/NetworkACLService.java
@@ -20,6 +20,7 @@
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 b68b9cbdd..3e11e8c7c 100644
--- a/api/src/com/cloud/network/lb/LoadBalancingRule.java
+++ b/api/src/com/cloud/network/lb/LoadBalancingRule.java
@@ -26,18 +26,20 @@
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;
private List destinations;
private List stickinessPolicies;
private LbAutoScaleVmGroup autoScaleVmGroup;
+ private List healthCheckPolicies;
- public LoadBalancingRule(LoadBalancer lb, List destinations, List stickinessPolicies) {
+ public LoadBalancingRule(LoadBalancer lb, List destinations,
+ List stickinessPolicies, List healthCheckPolicies) {
this.lb = lb;
this.destinations = destinations;
this.stickinessPolicies = stickinessPolicies;
+ this.healthCheckPolicies = healthCheckPolicies;
}
@Override
@@ -129,6 +131,10 @@ public LoadBalancer getLb() {
return lb;
}
+ public void setDestinations(List destinations) {
+ this.destinations = destinations;
+ }
+
public List getDestinations() {
return destinations;
}
@@ -137,11 +143,21 @@ public List getStickinessPolicies() {
return stickinessPolicies;
}
+ public void setHealthCheckPolicies(List healthCheckPolicies) {
+ this.healthCheckPolicies = healthCheckPolicies;
+ }
+
+ public List getHealthCheckPolicies() {
+ return healthCheckPolicies;
+ }
public interface Destination {
String getIpAddress();
+
int getDestinationPortStart();
+
int getDestinationPortEnd();
+
boolean isRevoked();
}
@@ -175,6 +191,64 @@ public boolean isRevoked() {
}
}
+ public static class LbHealthCheckPolicy {
+ private String pingpath;
+ private String description;
+ private int responseTime;
+ private int healthcheckInterval;
+ private int healthcheckThresshold;
+ private int unhealthThresshold;
+ private boolean _revoke;
+
+ public LbHealthCheckPolicy(String pingpath, String description, int responseTime, int healthcheckInterval,
+ int healthcheckThresshold, int unhealthThresshold) {
+ this(pingpath, description, responseTime, healthcheckInterval, healthcheckThresshold, unhealthThresshold, false);
+ }
+
+ public LbHealthCheckPolicy(String pingpath, String description, int responseTime, int healthcheckInterval,
+ int healthcheckThresshold, int unhealthThresshold, boolean revoke) {
+ this.pingpath = pingpath;
+ this.description = description;
+ this.responseTime = responseTime;
+ this.healthcheckInterval = healthcheckInterval;
+ this.healthcheckThresshold = healthcheckThresshold;
+ this.unhealthThresshold = unhealthThresshold;
+ this._revoke = revoke;
+ }
+
+ public LbHealthCheckPolicy() {
+ }
+
+ public String getpingpath() {
+ return pingpath;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public int getResponseTime() {
+ return responseTime;
+ }
+
+ public int getHealthcheckInterval() {
+ return healthcheckInterval;
+ }
+
+ public int getHealthcheckThresshold() {
+ return healthcheckThresshold;
+ }
+
+ public int getUnhealthThresshold() {
+ return unhealthThresshold;
+ }
+
+ public boolean isRevoked() {
+ return _revoke;
+ }
+
+ }
+
public static class LbDestination implements Destination {
private int portStart;
private int portEnd;
@@ -192,10 +266,12 @@ public LbDestination(int portStart, int portEnd, String ip, boolean revoked) {
public String getIpAddress() {
return ip;
}
+
@Override
public int getDestinationPortStart() {
return portStart;
}
+
@Override
public int getDestinationPortEnd() {
return portEnd;
@@ -231,15 +307,16 @@ public Long getRelated() {
return null;
}
-
@Override
public TrafficType getTrafficType() {
return null;
}
+
@Override
public FirewallRuleType getType() {
return FirewallRuleType.User;
}
+
public LbAutoScaleVmGroup getAutoScaleVmGroup() {
return autoScaleVmGroup;
}
@@ -275,8 +352,7 @@ public static class LbAutoScalePolicy {
private final AutoScalePolicy policy;
private boolean revoked;
- public LbAutoScalePolicy(AutoScalePolicy policy, List conditions)
- {
+ public LbAutoScalePolicy(AutoScalePolicy policy, List conditions) {
this.policy = policy;
this.conditions = conditions;
}
@@ -310,7 +386,9 @@ public static class LbAutoScaleVmProfile {
private final String networkId;
private final String vmName;
- public LbAutoScaleVmProfile(AutoScaleVmProfile profile, String autoScaleUserApiKey, String autoScaleUserSecretKey, String csUrl, String zoneId, String domainId, String serviceOfferingId, String templateId, String vmName, String networkId) {
+ public LbAutoScaleVmProfile(AutoScaleVmProfile profile, String autoScaleUserApiKey,
+ String autoScaleUserSecretKey, String csUrl, String zoneId, String domainId, String serviceOfferingId,
+ String templateId, String vmName, String networkId) {
this.profile = profile;
this.autoScaleUserApiKey = autoScaleUserApiKey;
this.autoScaleUserSecretKey = autoScaleUserSecretKey;
@@ -370,7 +448,8 @@ public static class LbAutoScaleVmGroup {
private final LbAutoScaleVmProfile profile;
private final String currentState;
- public LbAutoScaleVmGroup(AutoScaleVmGroup vmGroup, List policies, LbAutoScaleVmProfile profile, String currentState) {
+ public LbAutoScaleVmGroup(AutoScaleVmGroup vmGroup, List policies,
+ LbAutoScaleVmProfile profile, String currentState) {
this.vmGroup = vmGroup;
this.policies = policies;
this.profile = profile;
diff --git a/api/src/com/cloud/network/lb/LoadBalancingRulesService.java b/api/src/com/cloud/network/lb/LoadBalancingRulesService.java
index 4081f6efc..ed39bedaa 100644
--- a/api/src/com/cloud/network/lb/LoadBalancingRulesService.java
+++ b/api/src/com/cloud/network/lb/LoadBalancingRulesService.java
@@ -18,12 +18,20 @@
import java.util.List;
-import org.apache.cloudstack.api.command.user.loadbalancer.*;
+import org.apache.cloudstack.api.command.user.loadbalancer.CreateLBHealthCheckPolicyCmd;
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.ListLBHealthCheckPoliciesCmd;
+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;
+import com.cloud.network.lb.LoadBalancingRule.LbStickinessPolicy;
+import com.cloud.network.rules.HealthCheckPolicy;
import com.cloud.network.rules.LoadBalancer;
import com.cloud.network.rules.StickinessPolicy;
import com.cloud.uservm.UserVm;
@@ -62,6 +70,22 @@ public interface LoadBalancingRulesService {
public boolean applyLBStickinessPolicy(CreateLBStickinessPolicyCmd cmd) throws ResourceUnavailableException;
boolean deleteLBStickinessPolicy(long stickinessPolicyId, boolean apply);
+
+ /**
+ * Create a healthcheck policy to a load balancer from the given healthcheck
+ * parameters in (name,value) pairs.
+ *
+ * @param cmd
+ * the command specifying the stickiness method name, params
+ * (name,value pairs), policy name and description.
+ * @return the newly created stickiness policy if successfull, null
+ * otherwise
+ * @thows NetworkRuleConflictException
+ */
+ public HealthCheckPolicy createLBHealthCheckPolicy(CreateLBHealthCheckPolicyCmd cmd);
+ public boolean applyLBHealthCheckPolicy(CreateLBHealthCheckPolicyCmd cmd) throws ResourceUnavailableException;
+ boolean deleteLBHealthCheckPolicy(long healthCheckPolicyId, boolean apply);
+
/**
* Assign a virtual machine, or list of virtual machines, to a load balancer.
*/
@@ -100,8 +124,18 @@ public interface LoadBalancingRulesService {
*/
List extends StickinessPolicy> searchForLBStickinessPolicies(ListLBStickinessPoliciesCmd cmd);
+ /**
+ * List healthcheck policies based on the given criteria
+ *
+ * @param cmd
+ * the command specifies the load balancing rule id.
+ * @return list of healthcheck policies that match the criteria.
+ */
+
+ List extends HealthCheckPolicy> searchForLBHealthCheckPolicies(ListLBHealthCheckPoliciesCmd cmd);
+
List listByNetworkId(long networkId);
LoadBalancer findById(long LoadBalancer);
-
+ public void updateLBHealthChecks() throws ResourceUnavailableException;
}
diff --git a/api/src/com/cloud/network/rules/HealthCheckPolicy.java b/api/src/com/cloud/network/rules/HealthCheckPolicy.java
new file mode 100644
index 000000000..96bb28204
--- /dev/null
+++ b/api/src/com/cloud/network/rules/HealthCheckPolicy.java
@@ -0,0 +1,45 @@
+// 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.rules;
+
+import java.util.List;
+
+import com.cloud.utils.Pair;
+import org.apache.cloudstack.api.Identity;
+import org.apache.cloudstack.api.InternalIdentity;
+
+/**
+ */
+public interface HealthCheckPolicy extends InternalIdentity, Identity {
+
+ public long getLoadBalancerId();
+
+ public String getpingpath();
+
+ public String getDescription();
+
+ public int getResponseTime();
+
+ public int getHealthcheckInterval();
+
+ public int getHealthcheckThresshold();
+
+ public int getUnhealthThresshold();
+
+ public boolean isRevoke();
+
+}
diff --git a/api/src/com/cloud/network/rules/LbStickinessMethod.java b/api/src/com/cloud/network/rules/LbStickinessMethod.java
index c71b19e3a..1e5a55e6c 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 80c96d558..d47b38f9d 100644
--- a/api/src/com/cloud/network/rules/RulesService.java
+++ b/api/src/com/cloud/network/rules/RulesService.java
@@ -19,11 +19,13 @@
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;
import com.cloud.user.Account;
import com.cloud.utils.Pair;
+import com.cloud.utils.net.Ip;
public interface RulesService {
Pair, Integer> searchStaticNatRules(Long ipId, Long id, Long vmId, Long start, Long size, String accountName, Long domainId, Long projectId, boolean isRecursive, boolean listAll);
@@ -42,7 +44,7 @@ public interface RulesService {
* @throws NetworkRuleConflictException
* if conflicts in the network rules are detected.
*/
- PortForwardingRule createPortForwardingRule(PortForwardingRule rule, Long vmId, boolean openFirewall) throws NetworkRuleConflictException;
+ PortForwardingRule createPortForwardingRule(PortForwardingRule rule, Long vmId, Ip vmIp, boolean openFirewall) throws NetworkRuleConflictException;
/**
* Revokes a port forwarding rule
@@ -65,7 +67,7 @@ public interface RulesService {
boolean applyPortForwardingRules(long ipAdddressId, Account caller) throws ResourceUnavailableException;
- boolean enableStaticNat(long ipAddressId, long vmId, long networkId, boolean isSystemVm) throws NetworkRuleConflictException, ResourceUnavailableException;
+ boolean enableStaticNat(long ipAddressId, long vmId, long networkId, boolean isSystemVm, String vmGuestIp) throws NetworkRuleConflictException, ResourceUnavailableException;
PortForwardingRule getPortForwardigRule(long ruleId);
diff --git a/api/src/com/cloud/network/rules/StickinessPolicy.java b/api/src/com/cloud/network/rules/StickinessPolicy.java
index e23ff828f..da4875466 100644
--- a/api/src/com/cloud/network/rules/StickinessPolicy.java
+++ b/api/src/com/cloud/network/rules/StickinessPolicy.java
@@ -18,10 +18,11 @@
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 0b575e10d..d255e46fd 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 741f179db..397de1ccb 100644
--- a/api/src/com/cloud/network/security/SecurityGroupService.java
+++ b/api/src/com/cloud/network/security/SecurityGroupService.java
@@ -18,7 +18,13 @@
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 org.apache.cloudstack.api.command.user.vm.AddIpToVmNicCmd;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.PermissionDeniedException;
@@ -40,5 +46,6 @@ public interface SecurityGroupService {
public List extends SecurityRule> authorizeSecurityGroupIngress(AuthorizeSecurityGroupIngressCmd cmd);
public List extends SecurityRule> authorizeSecurityGroupEgress(AuthorizeSecurityGroupEgressCmd cmd);
-
+ public boolean securityGroupRulesForVmSecIp(Long nicId, Long networkId,
+ String secondaryIp, boolean ruleAction);
}
diff --git a/api/src/com/cloud/network/security/SecurityRule.java b/api/src/com/cloud/network/security/SecurityRule.java
index bd4192d61..350b52dbb 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 656355590..54aa6e4dd 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 9365e56dd..249e80f1a 100644
--- a/api/src/com/cloud/network/vpc/Vpc.java
+++ b/api/src/com/cloud/network/vpc/Vpc.java
@@ -17,34 +17,66 @@
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;
public interface Vpc extends ControlledEntity, Identity, InternalIdentity {
+
public enum State {
Enabled,
Inactive
}
- public static final String _supportedProviders = Network.Provider.VPCVirtualRouter.getName();
-
- boolean readyToUse();
-
+ /**
+ *
+ * @return VPC name
+ */
String getName();
+
+ /**
+ * @return the id of the zone the VPC belongs to
+ */
long getZoneId();
+
+ /**
+ * @return super CIDR of the VPC. All the networks participating in VPC, should have CIDRs that are the part of the super cidr
+ */
String getCidr();
+ /**
+ *
+ * @return VPC state
+ */
State getState();
+
+ /**
+ *
+ * @return VPC offering id - the offering that VPC is created from
+ */
long getVpcOfferingId();
+
+ /**
+ *
+ * @return VPC display text
+ */
String getDisplayText();
+
+ /**
+ *
+ * @return VPC network domain. All networks participating in the VPC, become the part of the same network domain
+ */
String getNetworkDomain();
+
+ /**
+ *
+ * @return true if restart is required for the VPC; false otherwise
+ */
boolean isRestartRequired();
}
diff --git a/api/src/com/cloud/network/vpc/VpcOffering.java b/api/src/com/cloud/network/vpc/VpcOffering.java
index 1acfcd214..3961d0aab 100644
--- a/api/src/com/cloud/network/vpc/VpcOffering.java
+++ b/api/src/com/cloud/network/vpc/VpcOffering.java
@@ -27,18 +27,33 @@ public enum State {
public static final String defaultVPCOfferingName = "Default VPC offering";
+ /**
+ *
+ * @return VPC offering name
+ */
String getName();
- String getUniqueName();
-
+
+ /**
+ * @return VPC offering display text
+ */
String getDisplayText();
+
+ /**
+ *
+ * @return VPC offering state
+ */
State getState();
+ /**
+ *
+ * @return true if offering is default - came with the cloudStack fresh install; false otherwise
+ */
boolean isDefault();
/**
- * @return
+ * @return service offering id used by VPC virutal router
*/
Long getServiceOfferingId();
diff --git a/api/src/com/cloud/network/vpc/VpcProvisioningService.java b/api/src/com/cloud/network/vpc/VpcProvisioningService.java
new file mode 100644
index 000000000..70676ce07
--- /dev/null
+++ b/api/src/com/cloud/network/vpc/VpcProvisioningService.java
@@ -0,0 +1,46 @@
+// 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.vpc;
+
+import java.util.List;
+import java.util.Map;
+
+public interface VpcProvisioningService {
+
+ public VpcOffering getVpcOffering(long vpcOfferingId);
+
+ public VpcOffering createVpcOffering(String name, String displayText, List supportedServices, Map> serviceProviders);
+
+ List extends VpcOffering> listVpcOfferings(Long id, String name, String displayText, List supportedServicesStr,
+ Boolean isDefault, String keyword, String state, Long startIndex, Long pageSizeVal);
+
+ /**
+ * @param offId
+ * @return
+ */
+ public boolean deleteVpcOffering(long offId);
+
+ /**
+ * @param vpcOffId
+ * @param vpcOfferingName
+ * @param displayText
+ * @param state
+ * @return
+ */
+ public VpcOffering updateVpcOffering(long vpcOffId, String vpcOfferingName, String displayText, String state);
+
+}
diff --git a/api/src/com/cloud/network/vpc/VpcService.java b/api/src/com/cloud/network/vpc/VpcService.java
index 68e062c7d..07ce89b0a 100644
--- a/api/src/com/cloud/network/vpc/VpcService.java
+++ b/api/src/com/cloud/network/vpc/VpcService.java
@@ -18,10 +18,10 @@
import java.util.List;
import java.util.Map;
-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;
@@ -30,45 +30,29 @@
import com.cloud.exception.ResourceUnavailableException;
import com.cloud.network.IpAddress;
import com.cloud.network.Network;
-import com.cloud.network.Network.Provider;
-import com.cloud.network.Network.Service;
-import com.cloud.user.Account;
-import com.cloud.user.User;
import com.cloud.utils.Pair;
public interface VpcService {
- public VpcOffering getVpcOffering(long vpcOfferingId);
-
- public VpcOffering createVpcOffering(String name, String displayText, List supportedServices);
-
- public Vpc getVpc(long vpcId);
-
- public Vpc getActiveVpc(long vpcId);
-
- public List extends Network> getVpcNetworks(long vpcId);
-
- Map> getVpcOffSvcProvidersMap(long vpcOffId);
-
- List extends VpcOffering> listVpcOfferings(Long id, String name, String displayText, List supportedServicesStr,
- Boolean isDefault, String keyword, String state, Long startIndex, Long pageSizeVal);
-
- /**
- * @param offId
+ /**Returns existing VPC found by id
+ *
+ * @param vpcId
* @return
*/
- public boolean deleteVpcOffering(long offId);
+ public Vpc getVpc(long vpcId);
+
/**
- * @param vpcOffId
- * @param vpcOfferingName
- * @param displayText
- * @param state
+ * Returns all the Guest networks that are part of VPC
+ *
+ * @param vpcId
* @return
*/
- public VpcOffering updateVpcOffering(long vpcOffId, String vpcOfferingName, String displayText, String state);
+ public List extends Network> getVpcNetworks(long vpcId);
/**
+ * Persists VPC record in the database
+ *
* @param zoneId
* @param vpcOffId
* @param vpcOwnerId
@@ -82,7 +66,10 @@ List extends VpcOffering> listVpcOfferings(Long id, String name, String displa
public Vpc createVpc(long zoneId, long vpcOffId, long vpcOwnerId, String vpcName, String displayText, String cidr,
String networkDomain) throws ResourceAllocationException;
+
/**
+ * Deletes a VPC
+ *
* @param vpcId
* @return
* @throws InsufficientCapacityException
@@ -91,7 +78,10 @@ public Vpc createVpc(long zoneId, long vpcOffId, long vpcOwnerId, String vpcName
*/
public boolean deleteVpc(long vpcId) throws ConcurrentOperationException, ResourceUnavailableException;
+
/**
+ * Updates VPC with new name/displayText
+ *
* @param vpcId
* @param vpcName
* @param displayText
@@ -99,7 +89,10 @@ public Vpc createVpc(long zoneId, long vpcOffId, long vpcOwnerId, String vpcName
*/
public Vpc updateVpc(long vpcId, String vpcName, String displayText);
+
/**
+ * Lists VPC(s) based on the parameters passed to the method call
+ *
* @param id
* @param vpcName
* @param displayText
@@ -126,6 +119,8 @@ public List extends Vpc> listVpcs(Long id, String vpcName, String displayText,
Boolean restartRequired, Map tags, Long projectId);
/**
+ * Starts VPC which includes starting VPC provider and applying all the neworking rules on the backend
+ *
* @param vpcId
* @param destroyOnFailure TODO
* @return
@@ -137,6 +132,8 @@ boolean startVpc(long vpcId, boolean destroyOnFailure) throws ConcurrentOperatio
ResourceUnavailableException, InsufficientCapacityException;
/**
+ * Shuts down the VPC which includes shutting down all VPC provider and rules cleanup on the backend
+ *
* @param vpcId
* @return
* @throws ConcurrentOperationException
@@ -144,16 +141,28 @@ boolean startVpc(long vpcId, boolean destroyOnFailure) throws ConcurrentOperatio
*/
boolean shutdownVpc(long vpcId) throws ConcurrentOperationException, ResourceUnavailableException;
+
/**
+ * Restarts the VPC. VPC gets shutdown and started as a part of it
+ *
* @param id
* @return
* @throws InsufficientCapacityException
*/
boolean restartVpc(long id) throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException;
+ /**
+ * Returns a Private gateway found in the VPC by id
+ *
+ * @param id
+ * @return
+ */
PrivateGateway getVpcPrivateGateway(long id);
+
/**
+ * Persists VPC private gateway in the Database.
+ *
* @param vpcId TODO
* @param physicalNetworkId
* @param vlan
@@ -171,6 +180,8 @@ public PrivateGateway createVpcPrivateGateway(long vpcId, Long physicalNetworkId
ConcurrentOperationException, InsufficientCapacityException;
/**
+ * Applies VPC private gateway on the backend, so it becomes functional
+ *
* @param gatewayId
* @param destroyOnFailure TODO
* @return
@@ -179,7 +190,10 @@ public PrivateGateway createVpcPrivateGateway(long vpcId, Long physicalNetworkId
*/
public PrivateGateway applyVpcPrivateGateway(long gatewayId, boolean destroyOnFailure) throws ConcurrentOperationException, ResourceUnavailableException;
+
/**
+ * Deletes VPC private gateway
+ *
* @param id
* @return
* @throws ResourceUnavailableException
@@ -187,52 +201,76 @@ public PrivateGateway createVpcPrivateGateway(long vpcId, Long physicalNetworkId
*/
boolean deleteVpcPrivateGateway(long gatewayId) throws ConcurrentOperationException, ResourceUnavailableException;
+
/**
+ * Returns the list of Private gateways existing in the VPC
+ *
* @param listPrivateGatewaysCmd
* @return
*/
public Pair, Integer> listPrivateGateway(ListPrivateGatewaysCmd listPrivateGatewaysCmd);
+
/**
+ * Returns Static Route found by Id
+ *
* @param routeId
* @return
*/
StaticRoute getStaticRoute(long routeId);
+
/**
+ * Applies existing Static Routes to the VPC elements
+ *
* @param vpcId
* @return
* @throws ResourceUnavailableException
*/
public boolean applyStaticRoutes(long vpcId) throws ResourceUnavailableException;
+
/**
+ * Deletes static route from the backend and the database
+ *
* @param routeId
* @return TODO
* @throws ResourceUnavailableException
*/
public boolean revokeStaticRoute(long routeId) throws ResourceUnavailableException;
+
/**
+ * Persists static route entry in the Database
+ *
* @param gatewayId
* @param cidr
* @return
*/
public StaticRoute createStaticRoute(long gatewayId, String cidr) throws NetworkRuleConflictException;
+
/**
+ * Lists static routes based on parameters passed to the call
+ *
* @param listStaticRoutesCmd
* @return
*/
public Pair, Integer> listStaticRoutes(ListStaticRoutesCmd cmd);
+
/**
+ * Returns gateway (VPN or Public) existign in the VPC
+ *
* @param id
* @return
*/
VpcGateway getVpcGateway(long id);
+
/**
+ * Associates IP address from the Public network, to the VPC
+ *
* @param ipId
* @param vpcId
* @return
@@ -244,6 +282,4 @@ public PrivateGateway createVpcPrivateGateway(long vpcId, Long physicalNetworkId
IpAddress associateIPToVpc(long ipId, long vpcId) throws ResourceAllocationException, ResourceUnavailableException,
InsufficientAddressCapacityException, ConcurrentOperationException;
- public Network updateVpcGuestNetwork(long networkId, String name, String displayText, Account callerAccount,
- User callerUser, String domainSuffix, Long ntwkOffId, Boolean changeCidr);
}
diff --git a/api/src/com/cloud/network/vpn/RemoteAccessVpnService.java b/api/src/com/cloud/network/vpn/RemoteAccessVpnService.java
index 81599a0c3..d637da638 100644
--- a/api/src/com/cloud/network/vpn/RemoteAccessVpnService.java
+++ b/api/src/com/cloud/network/vpn/RemoteAccessVpnService.java
@@ -18,8 +18,9 @@
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;
@@ -44,6 +45,6 @@ RemoteAccessVpn createRemoteAccessVpn(long vpnServerAddressId, String ipRange, b
List extends RemoteAccessVpn> listRemoteAccessVpns(long networkId);
- RemoteAccessVpn getRemoteAccessVpn(long vpnId);
+ RemoteAccessVpn getRemoteAccessVpn(long vpnAddrId);
}
diff --git a/api/src/com/cloud/network/vpn/Site2SiteVpnService.java b/api/src/com/cloud/network/vpn/Site2SiteVpnService.java
index 7ac567774..d90e3a997 100644
--- a/api/src/com/cloud/network/vpn/Site2SiteVpnService.java
+++ b/api/src/com/cloud/network/vpn/Site2SiteVpnService.java
@@ -18,7 +18,6 @@
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.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 9a48f4bb6..dd77c70ab 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 f2c4de520..bd14acd47 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
*
@@ -45,6 +46,7 @@ public enum State {
public final static String SystemPrivateGatewayNetworkOffering = "System-Private-Gateway-Network-Offering";
public final static String DefaultSharedNetworkOfferingWithSGService = "DefaultSharedNetworkOfferingWithSGService";
+ public final static String QuickCloudNoServices = "QuickCloudNoServices";
public final static String DefaultIsolatedNetworkOfferingWithSourceNatService = "DefaultIsolatedNetworkOfferingWithSourceNatService";
public final static String OvsIsolatedNetworkOfferingWithSourceNatService = "OvsIsolatedNetworkOfferingWithSourceNatService";
public final static String DefaultSharedNetworkOffering = "DefaultSharedNetworkOffering";
@@ -110,4 +112,7 @@ public enum State {
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 b13346cfb..d6c215f42 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 enum StorageType {
*/
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 cb72a70b8..d14f86bcb 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 78d52574f..9240930c2 100644
--- a/api/src/com/cloud/projects/Project.java
+++ b/api/src/com/cloud/projects/Project.java
@@ -19,9 +19,10 @@
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/region/ha/GlobalLoadBalancerRule.java b/api/src/com/cloud/region/ha/GlobalLoadBalancerRule.java
new file mode 100644
index 000000000..597304fa8
--- /dev/null
+++ b/api/src/com/cloud/region/ha/GlobalLoadBalancerRule.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 com.cloud.region.ha;
+
+import org.apache.cloudstack.acl.ControlledEntity;
+import org.apache.cloudstack.api.Identity;
+import org.apache.cloudstack.api.InternalIdentity;
+
+/**
+ * GlobalLoadBalancerRule defines a global (multi zone) load balancing configuration.
+ */
+public interface GlobalLoadBalancerRule extends Identity, InternalIdentity, ControlledEntity {
+
+ enum Algorithm {
+
+ RoundRobin,
+ LeastConn,
+ Proximity;
+
+ public static boolean isValidAlgorithm(String algorithm) {
+ if (RoundRobin.name().equalsIgnoreCase(algorithm) ||
+ LeastConn.name().equalsIgnoreCase(algorithm) ||
+ Proximity.name().equalsIgnoreCase(algorithm)) {
+ return true;
+ }
+ return false;
+ }
+ }
+ enum Persistence {
+
+ sourceip;
+
+ public static boolean isValidPersistence(String persistence) {
+ if (sourceip.name().equalsIgnoreCase(persistence)) {
+ return true;
+ }
+ return false;
+ }
+ }
+
+ enum ServiceType {
+ tcp,
+ udp;
+ public static boolean isValidServiceType(String serviceType) {
+ if (tcp.name().equalsIgnoreCase(serviceType) || udp.name().equalsIgnoreCase(serviceType)) {
+ return true;
+ }
+ return false;
+ }
+ }
+ enum State {
+ Staged,
+ Add,
+ Active,
+ Revoke
+ }
+
+ public String getName();
+
+ public String getDescription();
+
+ public String getGslbDomain();
+
+ public String getAlgorithm();
+
+ public String getPersistence();
+
+ public int getRegion();
+
+ public long getAccountId();
+
+ public State getState();
+
+ public String getServiceType();
+}
diff --git a/api/src/com/cloud/region/ha/GlobalLoadBalancingRulesService.java b/api/src/com/cloud/region/ha/GlobalLoadBalancingRulesService.java
new file mode 100644
index 000000000..e2f097e29
--- /dev/null
+++ b/api/src/com/cloud/region/ha/GlobalLoadBalancingRulesService.java
@@ -0,0 +1,47 @@
+// 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.region.ha;
+
+import org.apache.cloudstack.api.command.user.region.ha.gslb.*;
+
+import java.util.List;
+
+public interface GlobalLoadBalancingRulesService {
+
+ /*
+ * methods for managing life cycle of global load balancing rules
+ */
+ GlobalLoadBalancerRule createGlobalLoadBalancerRule(CreateGlobalLoadBalancerRuleCmd createGslbCmd);
+
+ boolean deleteGlobalLoadBalancerRule(DeleteGlobalLoadBalancerRuleCmd deleteGslbCmd);
+
+ GlobalLoadBalancerRule updateGlobalLoadBalancerRule(UpdateGlobalLoadBalancerRuleCmd updateGslbCmd);
+
+ /*
+ * methods for managing sites participating in global load balancing
+ */
+ boolean assignToGlobalLoadBalancerRule(AssignToGlobalLoadBalancerRuleCmd assignToGslbCmd);
+
+ boolean removeFromGlobalLoadBalancerRule(RemoveFromGlobalLoadBalancerRuleCmd removeFromGslbCmd);
+
+
+ GlobalLoadBalancerRule findById(long gslbRuleId);
+
+ List listGlobalLoadBalancerRule(ListGlobalLoadBalancerRuleCmd listGslbCmd);
+
+}
diff --git a/api/src/com/cloud/resource/ResourceService.java b/api/src/com/cloud/resource/ResourceService.java
index 7348a5a68..08e2585d1 100755
--- a/api/src/com/cloud/resource/ResourceService.java
+++ b/api/src/com/cloud/resource/ResourceService.java
@@ -20,12 +20,18 @@
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;
@@ -36,7 +42,6 @@
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 {
/**
@@ -66,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;
@@ -95,7 +100,7 @@ public interface ResourceService {
Swift discoverSwift(AddSwiftCmd addSwiftCmd) throws DiscoveryException;
S3 discoverS3(AddS3Cmd cmd) throws DiscoveryException;
-
+
List getSupportedHypervisorTypes(long zoneId, boolean forVirtualRouter, Long podId);
Pair, Integer> listSwifts(ListSwiftsCmd cmd);
diff --git a/api/src/com/cloud/server/ManagementService.java b/api/src/com/cloud/server/ManagementService.java
index 32c2b0530..6e6dbc36f 100755
--- a/api/src/com/cloud/server/ManagementService.java
+++ b/api/src/com/cloud/server/ManagementService.java
@@ -22,46 +22,45 @@
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.ArchiveAlertsCmd;
+import org.apache.cloudstack.api.command.admin.resource.DeleteAlertsCmd;
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.ListGuestOsCmd;
-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.event.ArchiveEventsCmd;
+import org.apache.cloudstack.api.command.user.event.DeleteEventsCmd;
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.ssh.CreateSSHKeyPairCmd;
+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 com.cloud.alert.Alert;
import com.cloud.capacity.Capacity;
import com.cloud.configuration.Configuration;
-import com.cloud.dc.DataCenter;
import com.cloud.dc.Pod;
import com.cloud.dc.Vlan;
import com.cloud.domain.Domain;
@@ -73,12 +72,9 @@
import com.cloud.hypervisor.Hypervisor.HypervisorType;
import com.cloud.hypervisor.HypervisorCapabilities;
import com.cloud.network.IpAddress;
-import com.cloud.offering.DiskOffering;
-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;
@@ -196,6 +192,34 @@ public interface ManagementService {
*/
Pair, Integer> searchForAlerts(ListAlertsCmd cmd);
+ /**
+ * Archive alerts
+ * @param cmd
+ * @return True on success. False otherwise.
+ */
+ boolean archiveAlerts(ArchiveAlertsCmd cmd);
+
+ /**
+ * Delete alerts
+ * @param cmd
+ * @return True on success. False otherwise.
+ */
+ boolean deleteAlerts(DeleteAlertsCmd cmd);
+
+ /**
+ * Archive events
+ * @param cmd
+ * @return True on success. False otherwise.
+ */
+ boolean archiveEvents(ArchiveEventsCmd cmd);
+
+ /**
+ * Delete events
+ * @param cmd
+ * @return True on success. False otherwise.
+ */
+ boolean deleteEvents(DeleteEventsCmd cmd);
+
/**
* list all the capacity rows in capacity operations table
*
@@ -383,4 +407,6 @@ public interface ManagementService {
*/
List extends Capacity> listTopConsumedResources(ListCapacityCmd cmd);
+ List listDeploymentPlanners();
+
}
diff --git a/api/src/com/cloud/server/ResourceTag.java b/api/src/com/cloud/server/ResourceTag.java
index 5ec9f0171..9006e305d 100644
--- a/api/src/com/cloud/server/ResourceTag.java
+++ b/api/src/com/cloud/server/ResourceTag.java
@@ -37,7 +37,9 @@ public enum TaggedResourceType {
Project,
Vpc,
NetworkACL,
- StaticRoute
+ StaticRoute,
+ VMSnapshot,
+ RemoteAccessVpn
}
/**
diff --git a/api/src/com/cloud/storage/DataStoreProviderApiService.java b/api/src/com/cloud/storage/DataStoreProviderApiService.java
new file mode 100644
index 000000000..f81a9960b
--- /dev/null
+++ b/api/src/com/cloud/storage/DataStoreProviderApiService.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.storage;
+
+import java.util.List;
+
+import org.apache.cloudstack.api.response.StorageProviderResponse;
+
+public interface DataStoreProviderApiService {
+ public List getDataStoreProviders(String type);
+
+}
diff --git a/api/src/com/cloud/storage/S3.java b/api/src/com/cloud/storage/S3.java
index 708e280ca..0c58a9029 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 2e2965ae1..f71265cd2 100644
--- a/api/src/com/cloud/storage/Snapshot.java
+++ b/api/src/com/cloud/storage/Snapshot.java
@@ -16,15 +16,14 @@
// under the License.
package com.cloud.storage;
+import java.util.Date;
+
import com.cloud.hypervisor.Hypervisor.HypervisorType;
-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.util.Date;
-
public interface Snapshot extends ControlledEntity, Identity, InternalIdentity, StateObject {
public enum Type {
MANUAL,
@@ -44,6 +43,7 @@ public int getMax() {
return max;
}
+ @Override
public String toString() {
return this.name();
}
@@ -54,28 +54,13 @@ public boolean equals(String snapshotType) {
}
public enum State {
+ Allocated,
Creating,
CreatedOnPrimary,
BackingUp,
BackedUp,
Error;
- private final static StateMachine2 s_fsm = new StateMachine2();
-
- public static StateMachine2 getStateMachine() {
- return s_fsm;
- }
-
- static {
- s_fsm.addTransition(null, Event.CreateRequested, Creating);
- s_fsm.addTransition(Creating, Event.OperationSucceeded, CreatedOnPrimary);
- s_fsm.addTransition(Creating, Event.OperationNotPerformed, BackedUp);
- s_fsm.addTransition(Creating, Event.OperationFailed, Error);
- s_fsm.addTransition(CreatedOnPrimary, Event.BackupToSecondary, BackingUp);
- s_fsm.addTransition(BackingUp, Event.OperationSucceeded, BackedUp);
- s_fsm.addTransition(BackingUp, Event.OperationFailed, Error);
- }
-
public String toString() {
return this.name();
}
@@ -106,7 +91,7 @@ enum Event {
Date getCreated();
- Type getType();
+ Type getRecurringType();
State getState();
diff --git a/api/src/com/cloud/storage/Storage.java b/api/src/com/cloud/storage/Storage.java
index fba12b62d..c130fe222 100755
--- a/api/src/com/cloud/storage/Storage.java
+++ b/api/src/com/cloud/storage/Storage.java
@@ -26,7 +26,8 @@ public static enum ImageFormat {
VHD(true, true, true),
ISO(false, false, false),
OVA(true, true, true, "ova"),
- BAREMETAL(false, false, false);
+ BAREMETAL(false, false, false),
+ TAR(false, false, false);
private final boolean thinProvisioned;
private final boolean supportSparse;
diff --git a/api/src/com/cloud/storage/StoragePool.java b/api/src/com/cloud/storage/StoragePool.java
index 3334da54e..8b95383c5 100644
--- a/api/src/com/cloud/storage/StoragePool.java
+++ b/api/src/com/cloud/storage/StoragePool.java
@@ -18,10 +18,11 @@
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
+ */
+ String getStorageProviderName();
+
+ boolean isInMaintenance();
}
diff --git a/api/src/com/cloud/storage/StoragePoolStatus.java b/api/src/com/cloud/storage/StoragePoolStatus.java
index 0c9496144..a35f706d7 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 a06f21380..63c5023ee 100644
--- a/api/src/com/cloud/storage/StorageService.java
+++ b/api/src/com/cloud/storage/StorageService.java
@@ -18,19 +18,14 @@
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 org.apache.cloudstack.api.command.user.volume.ResizeVolumeCmd;
-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{
/**
@@ -49,37 +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);
-
-
- /**
- * Resizes the volume based on the given criteria
- *
- * @param cmd
- * the API command wrapping the criteria
- * @return the volume object
- */
- Volume resizeVolume(ResizeVolumeCmd cmd);
-
/**
* Delete the storage pool
*
@@ -118,19 +82,4 @@ public StoragePool cancelPrimaryStorageForMaintenance(CancelPrimaryStorageMainte
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 9cd3a34cd..028e96e48 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 a20faf1dc..ac3836caf 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 97baa4b29..d40eafe7a 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 38ba2d413..4903594f0 100755
--- a/api/src/com/cloud/storage/Volume.java
+++ b/api/src/com/cloud/storage/Volume.java
@@ -19,11 +19,12 @@
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 {
@@ -38,8 +39,12 @@ enum State {
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;
@@ -63,17 +68,20 @@ public String getDescription() {
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);
@@ -81,6 +89,9 @@ public String getDescription() {
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);
}
}
@@ -108,7 +119,7 @@ enum Event {
/**
* @return total size of the partition
*/
- long getSize();
+ Long getSize();
/**
* @return the vm instance id
@@ -152,4 +163,14 @@ enum Event {
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 000000000..09a07d4be
--- /dev/null
+++ b/api/src/com/cloud/storage/VolumeApiService.java
@@ -0,0 +1,82 @@
+/*
+ * 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
+ * @throws ResourceAllocationException
+ */
+ Volume resizeVolume(ResizeVolumeCmd cmd) throws ResourceAllocationException;
+
+ 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 18b850716..b5325f520 100644
--- a/api/src/com/cloud/storage/snapshot/SnapshotService.java
+++ b/api/src/com/cloud/storage/snapshot/SnapshotService.java
@@ -19,10 +19,11 @@
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;
diff --git a/api/src/com/cloud/template/TemplateService.java b/api/src/com/cloud/template/TemplateService.java
index 93e8a2576..7e831fb00 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.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 274b7b638..cedc793c1 100755
--- a/api/src/com/cloud/template/VirtualMachineTemplate.java
+++ b/api/src/com/cloud/template/VirtualMachineTemplate.java
@@ -20,11 +20,12 @@
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 {
@@ -36,6 +37,7 @@ public enum TemplateFilter {
featured, // returns templates that have been marked as featured and public
self, // returns templates that have been registered or created by the calling user
selfexecutable, // same as self, but only returns templates that are ready to be deployed with
+ shared, // including templates that have been granted to the calling user by another user
sharedexecutable, // ready templates that have been granted to the calling user by another user
executable, // templates that are owned by the calling user, or public templates, that can be used to deploy a
community, // returns templates that have been marked as public but not featured
@@ -89,6 +91,5 @@ public enum TemplateFilter {
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 a5b3e8715..5d32fb232 100755
--- a/api/src/com/cloud/user/Account.java
+++ b/api/src/com/cloud/user/Account.java
@@ -62,5 +62,6 @@ public enum State {
public String getNetworkDomain();
public Long getDefaultZoneId();
-
+
+ public String getUuid();
}
diff --git a/api/src/com/cloud/user/AccountService.java b/api/src/com/cloud/user/AccountService.java
index 9f5f4d225..903eebc5b 100755
--- a/api/src/com/cloud/user/AccountService.java
+++ b/api/src/com/cloud/user/AccountService.java
@@ -22,16 +22,15 @@
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);
/**
* Locks a user by userId. A locked user cannot access the API, but will still have running VMs/IP addresses
@@ -102,71 +73,11 @@ UserAccount createUserAccount(String userName, String password, String firstName
*/
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);
boolean isAdmin(short accountType);
diff --git a/api/src/com/cloud/user/DomainService.java b/api/src/com/cloud/user/DomainService.java
index cd20060b7..7c302e377 100644
--- a/api/src/com/cloud/user/DomainService.java
+++ b/api/src/com/cloud/user/DomainService.java
@@ -20,13 +20,14 @@
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);
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 36a7c6543..3742c7bf3 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;
diff --git a/api/src/com/cloud/user/UserAccount.java b/api/src/com/cloud/user/UserAccount.java
index c09b5c0fa..0cb0f697a 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 539e11812..bcb33b5ed 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 long getCallerUserId() {
}
public User getCallerUser() {
+ if (_accountMgr == null) {
+ _accountMgr = ComponentContext.getComponent(AccountService.class);
+ }
return _accountMgr.getActiveUser(userId);
}
@@ -90,10 +89,10 @@ public static UserContext current() {
// 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 000000000..a54596373
--- /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 a587666bc..b1d1712d9 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 bb74d8483..e3a3386d1 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 DiskProfile(Volume vol, DiskOffering offering, HypervisorType hyperType)
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.
@@ -134,7 +139,19 @@ public void setHyperType(HypervisorType hyperType) {
this.hyperType = hyperType;
}
- public HypervisorType getHypersorType() {
+ public HypervisorType getHypervisorType() {
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 aeae2aed1..b2f697624 100644
--- a/api/src/com/cloud/vm/Nic.java
+++ b/api/src/com/cloud/vm/Nic.java
@@ -21,12 +21,13 @@
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.
@@ -150,4 +151,5 @@ public enum ReservationStrategy {
String getIp6Cidr();
String getIp6Address();
+ boolean getSecondaryIp();
}
diff --git a/api/src/com/cloud/vm/NicProfile.java b/api/src/com/cloud/vm/NicProfile.java
index 9a5e781ff..5970ccd24 100644
--- a/api/src/com/cloud/vm/NicProfile.java
+++ b/api/src/com/cloud/vm/NicProfile.java
@@ -18,13 +18,14 @@
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;
@@ -49,6 +50,8 @@ public class NicProfile implements InternalIdentity {
Integer deviceId;
String dns1;
String dns2;
+ String ip6Dns1;
+ String ip6Dns2;
Integer networkRate;
boolean isSecurityGroupEnabled;
String name;
@@ -331,4 +334,20 @@ 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/NicSecondaryIp.java b/api/src/com/cloud/vm/NicSecondaryIp.java
new file mode 100644
index 000000000..655d172b3
--- /dev/null
+++ b/api/src/com/cloud/vm/NicSecondaryIp.java
@@ -0,0 +1,36 @@
+// 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;
+
+import org.apache.cloudstack.acl.ControlledEntity;
+import org.apache.cloudstack.api.Identity;
+import org.apache.cloudstack.api.InternalIdentity;
+
+
+/**
+ * Nic represents one nic on the VM.
+ */
+public interface NicSecondaryIp extends ControlledEntity, Identity, InternalIdentity {
+ /**
+ * @return id in the CloudStack database
+ */
+ long getId();
+ long getNicId();
+ String getIp4Address();
+ long getNetworkId();
+ long getVmId();
+}
diff --git a/api/src/com/cloud/vm/UserVmService.java b/api/src/com/cloud/vm/UserVmService.java
index 9e7f77788..d963b74b0 100755
--- a/api/src/com/cloud/vm/UserVmService.java
+++ b/api/src/com/cloud/vm/UserVmService.java
@@ -22,21 +22,10 @@
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.admin.vm.RecoverVMCmd;
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.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.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.UpgradeVMCmd;
-
import com.cloud.dc.DataCenter;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientCapacityException;
@@ -50,7 +39,6 @@
import com.cloud.network.Network.IpAddresses;
import com.cloud.offering.ServiceOffering;
import com.cloud.storage.StoragePool;
-import com.cloud.storage.Volume;
import com.cloud.template.VirtualMachineTemplate;
import com.cloud.user.Account;
import com.cloud.uservm.UserVm;
@@ -99,24 +87,6 @@ public interface UserVmService {
*/
UserVm resetVMSSHKey(ResetVMSSHKeyCmd cmd) throws ResourceUnavailableException, InsufficientCapacityException;
- /**
- * Attaches the specified volume to the specified VM
- *
- * @param cmd
- * - the command specifying volumeId and vmId
- * @return the Volume object if attach worked successfully.
- */
- 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 startVirtualMachine(StartVMCmd cmd) throws StorageUnavailableException, ExecutionException, ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException,
ResourceAllocationException;
@@ -130,14 +100,14 @@ UserVm startVirtualMachine(StartVMCmd cmd) throws StorageUnavailableException, E
* @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
@@ -147,31 +117,10 @@ UserVm startVirtualMachine(StartVMCmd cmd) throws StorageUnavailableException, E
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.
+ * Creates a Basic Zone User VM in the database and returns the VM to the
+ * caller.
*
* @param zone
* - availability zone for the virtual machine
@@ -180,61 +129,69 @@ UserVm startVirtualMachine(StartVMCmd cmd) throws StorageUnavailableException, E
* @param template
* - the template for the virtual machine
* @param securityGroupIdList
- * - comma separated list of security groups id that going to be applied to the virtual machine
+ * - comma separated list of security groups id that going to be
+ * applied to the virtual machine
* @param hostName
* - host name for the virtual machine
* @param displayName
* - an optional user generated name for the virtual machine
* @param diskOfferingId
- * - the ID of the disk offering for the virtual machine. If the template is of ISO format, the
- * diskOfferingId is
- * for the root disk volume. Otherwise this parameter is used to indicate the offering for the data disk
- * volume.
- * If the templateId parameter passed is from a Template object, the diskOfferingId refers to a DATA Disk
- * Volume
- * created. If the templateId parameter passed is from an ISO object, the diskOfferingId refers to a ROOT
- * Disk
- * Volume created
+ * - the ID of the disk offering for the virtual machine. If the
+ * template is of ISO format, the diskOfferingId is for the root
+ * disk volume. Otherwise this parameter is used to indicate the
+ * offering for the data disk volume. If the templateId parameter
+ * passed is from a Template object, the diskOfferingId refers to
+ * a DATA Disk Volume created. If the templateId parameter passed
+ * is from an ISO object, the diskOfferingId refers to a ROOT
+ * Disk Volume created
* @param diskSize
- * - the arbitrary size for the DATADISK volume. Mutually exclusive with diskOfferingId
+ * - the arbitrary size for the DATADISK volume. Mutually
+ * exclusive with diskOfferingId
* @param group
* - an optional group for the virtual machine
* @param hypervisor
* - the hypervisor on which to deploy the virtual machine
* @param userData
- * - an optional binary data that can be sent to the virtual machine upon a successful deployment. This
- * binary
- * data must be base64 encoded before adding it to the request. Currently only HTTP GET is supported.
- * Using HTTP
- * GET (via querystring), you can send up to 2KB of data after base64 encoding
+ * - an optional binary data that can be sent to the virtual
+ * machine upon a successful deployment. This binary data must be
+ * base64 encoded before adding it to the request. Currently only
+ * HTTP GET is supported. Using HTTP GET (via querystring), you
+ * can send up to 2KB of data after base64 encoding
* @param sshKeyPair
- * - name of the ssh key pair used to login to the virtual machine
+ * - name of the ssh key pair used to login to the virtual
+ * machine
* @param requestedIps
* TODO
* @param defaultIp
* TODO
+ * @param affinityGroupIdList
* @param accountName
- * - an optional account for the virtual machine. Must be used with domainId
+ * - an optional account for the virtual machine. Must be used
+ * with domainId
* @param domainId
- * - an optional domainId for the virtual machine. If the account parameter is used, domainId must also
- * be used
+ * - an optional domainId for the virtual machine. If the account
+ * parameter is used, domainId must also be used
* @return UserVm object if successful.
*
* @throws InsufficientCapacityException
* if there is insufficient capacity to deploy the VM.
* @throws ConcurrentOperationException
- * if there are multiple users working on the same VM or in the same environment.
+ * if there are multiple users working on the same VM or in the
+ * same environment.
* @throws ResourceUnavailableException
- * if the resources required to deploy the VM is not currently available.
+ * if the resources required to deploy the VM is not currently
+ * available.
* @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, IpAddresses defaultIp, String keyboard)
+ String displayName, Long diskOfferingId, Long diskSize, String group, HypervisorType hypervisor,
+ String userData, String sshKeyPair, Map requestedIps, IpAddresses defaultIp,
+ String keyboard, List affinityGroupIdList)
throws InsufficientCapacityException, ConcurrentOperationException, ResourceUnavailableException, StorageUnavailableException, ResourceAllocationException;
/**
- * Creates a User VM in Advanced Zone (Security Group feature is enabled) in the database and returns the VM to the
- * caller.
+ * Creates a User VM in Advanced Zone (Security Group feature is enabled) in
+ * the database and returns the VM to the caller.
*
* @param zone
* - availability zone for the virtual machine
@@ -245,63 +202,69 @@ UserVm createBasicSecurityGroupVirtualMachine(DataCenter zone, ServiceOffering s
* @param networkIdList
* - list of network ids used by virtual machine
* @param securityGroupIdList
- * - comma separated list of security groups id that going to be applied to the virtual machine
+ * - comma separated list of security groups id that going to be
+ * applied to the virtual machine
* @param hostName
* - host name for the virtual machine
* @param displayName
* - an optional user generated name for the virtual machine
* @param diskOfferingId
- * - the ID of the disk offering for the virtual machine. If the template is of ISO format, the
- * diskOfferingId is
- * for the root disk volume. Otherwise this parameter is used to indicate the offering for the data disk
- * volume.
- * If the templateId parameter passed is from a Template object, the diskOfferingId refers to a DATA Disk
- * Volume
- * created. If the templateId parameter passed is from an ISO object, the diskOfferingId refers to a ROOT
- * Disk
- * Volume created
+ * - the ID of the disk offering for the virtual machine. If the
+ * template is of ISO format, the diskOfferingId is for the root
+ * disk volume. Otherwise this parameter is used to indicate the
+ * offering for the data disk volume. If the templateId parameter
+ * passed is from a Template object, the diskOfferingId refers to
+ * a DATA Disk Volume created. If the templateId parameter passed
+ * is from an ISO object, the diskOfferingId refers to a ROOT
+ * Disk Volume created
* @param diskSize
- * - the arbitrary size for the DATADISK volume. Mutually exclusive with diskOfferingId
+ * - the arbitrary size for the DATADISK volume. Mutually
+ * exclusive with diskOfferingId
* @param group
* - an optional group for the virtual machine
* @param hypervisor
* - the hypervisor on which to deploy the virtual machine
* @param userData
- * - an optional binary data that can be sent to the virtual machine upon a successful deployment. This
- * binary
- * data must be base64 encoded before adding it to the request. Currently only HTTP GET is supported.
- * Using HTTP
- * GET (via querystring), you can send up to 2KB of data after base64 encoding
+ * - an optional binary data that can be sent to the virtual
+ * machine upon a successful deployment. This binary data must be
+ * base64 encoded before adding it to the request. Currently only
+ * HTTP GET is supported. Using HTTP GET (via querystring), you
+ * can send up to 2KB of data after base64 encoding
* @param sshKeyPair
- * - name of the ssh key pair used to login to the virtual machine
+ * - name of the ssh key pair used to login to the virtual
+ * machine
* @param requestedIps
* TODO
* @param defaultIps
* TODO
+ * @param affinityGroupIdList
* @param accountName
- * - an optional account for the virtual machine. Must be used with domainId
+ * - an optional account for the virtual machine. Must be used
+ * with domainId
* @param domainId
- * - an optional domainId for the virtual machine. If the account parameter is used, domainId must also
- * be used
+ * - an optional domainId for the virtual machine. If the account
+ * parameter is used, domainId must also be used
* @return UserVm object if successful.
*
* @throws InsufficientCapacityException
* if there is insufficient capacity to deploy the VM.
* @throws ConcurrentOperationException
- * if there are multiple users working on the same VM or in the same environment.
+ * if there are multiple users working on the same VM or in the
+ * same environment.
* @throws ResourceUnavailableException
- * if the resources required to deploy the VM is not currently available.
+ * if the resources required to deploy the VM is not currently
+ * available.
* @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,
- IpAddresses defaultIps, String keyboard)
+ IpAddresses defaultIps, String keyboard, List affinityGroupIdList)
throws InsufficientCapacityException, ConcurrentOperationException, ResourceUnavailableException, StorageUnavailableException, ResourceAllocationException;
/**
- * Creates a User VM in Advanced Zone (Security Group feature is disabled) in the database and returns the VM to the
- * caller.
- *
+ * Creates a User VM in Advanced Zone (Security Group feature is disabled)
+ * in the database and returns the VM to the caller.
+ *
* @param zone
* - availability zone for the virtual machine
* @param serviceOffering
@@ -315,49 +278,57 @@ UserVm createAdvancedSecurityGroupVirtualMachine(DataCenter zone, ServiceOfferin
* @param displayName
* - an optional user generated name for the virtual machine
* @param diskOfferingId
- * - the ID of the disk offering for the virtual machine. If the template is of ISO format, the
- * diskOfferingId is
- * for the root disk volume. Otherwise this parameter is used to indicate the offering for the data disk
- * volume.
- * If the templateId parameter passed is from a Template object, the diskOfferingId refers to a DATA Disk
- * Volume
- * created. If the templateId parameter passed is from an ISO object, the diskOfferingId refers to a ROOT
- * Disk
- * Volume created
+ * - the ID of the disk offering for the virtual machine. If the
+ * template is of ISO format, the diskOfferingId is for the root
+ * disk volume. Otherwise this parameter is used to indicate the
+ * offering for the data disk volume. If the templateId parameter
+ * passed is from a Template object, the diskOfferingId refers to
+ * a DATA Disk Volume created. If the templateId parameter passed
+ * is from an ISO object, the diskOfferingId refers to a ROOT
+ * Disk Volume created
* @param diskSize
- * - the arbitrary size for the DATADISK volume. Mutually exclusive with diskOfferingId
+ * - the arbitrary size for the DATADISK volume. Mutually
+ * exclusive with diskOfferingId
* @param group
* - an optional group for the virtual machine
* @param hypervisor
* - the hypervisor on which to deploy the virtual machine
* @param userData
- * - an optional binary data that can be sent to the virtual machine upon a successful deployment. This
- * binary
- * data must be base64 encoded before adding it to the request. Currently only HTTP GET is supported.
- * Using HTTP
- * GET (via querystring), you can send up to 2KB of data after base64 encoding
+ * - an optional binary data that can be sent to the virtual
+ * machine upon a successful deployment. This binary data must be
+ * base64 encoded before adding it to the request. Currently only
+ * HTTP GET is supported. Using HTTP GET (via querystring), you
+ * can send up to 2KB of data after base64 encoding
* @param sshKeyPair
- * - name of the ssh key pair used to login to the virtual machine
+ * - name of the ssh key pair used to login to the virtual
+ * machine
* @param requestedIps
* TODO
- * @param defaultIps TODO
+ * @param defaultIps
+ * TODO
+ * @param affinityGroupIdList
* @param accountName
- * - an optional account for the virtual machine. Must be used with domainId
+ * - an optional account for the virtual machine. Must be used
+ * with domainId
* @param domainId
- * - an optional domainId for the virtual machine. If the account parameter is used, domainId must also
- * be used
+ * - an optional domainId for the virtual machine. If the account
+ * parameter is used, domainId must also be used
* @return UserVm object if successful.
- *
+ *
* @throws InsufficientCapacityException
* if there is insufficient capacity to deploy the VM.
* @throws ConcurrentOperationException
- * if there are multiple users working on the same VM or in the same environment.
+ * if there are multiple users working on the same VM or in the
+ * same environment.
* @throws ResourceUnavailableException
- * if the resources required to deploy the VM is not currently available.
+ * if the resources required to deploy the VM is not currently
+ * available.
* @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, IpAddresses defaultIps, String keyboard)
+ String displayName, Long diskOfferingId, Long diskSize, String group, HypervisorType hypervisor,
+ String userData, String sshKeyPair, Map requestedIps, IpAddresses defaultIps,
+ String keyboard, List affinityGroupIdList)
throws InsufficientCapacityException, ConcurrentOperationException, ResourceUnavailableException, StorageUnavailableException, ResourceAllocationException;
/**
@@ -393,8 +364,9 @@ UserVm createAdvancedVirtualMachine(DataCenter zone, ServiceOffering serviceOffe
* @param cmd
* - the command specifying vmId and new serviceOfferingId
* @return the vm
+ * @throws ResourceAllocationException
*/
- UserVm upgradeVirtualMachine(UpgradeVMCmd cmd);
+ UserVm upgradeVirtualMachine(UpgradeVMCmd cmd) throws ResourceAllocationException;
UserVm stopVirtualMachine(long vmId, boolean forced) throws ConcurrentOperationException;
@@ -438,4 +410,7 @@ UserVm createVirtualMachine(DeployVMCmd cmd) throws InsufficientCapacityExceptio
VirtualMachine vmStorageMigration(Long vmId, StoragePool destPool);
UserVm restoreVM(RestoreVMCmd cmd);
+
+ UserVm upgradeVirtualMachine(ScaleVMCmd scaleVMCmd) throws ResourceUnavailableException, ConcurrentOperationException, ManagementServerException, VirtualMachineMigrationException;
+
}
diff --git a/api/src/com/cloud/vm/VirtualMachine.java b/api/src/com/cloud/vm/VirtualMachine.java
index cd3057954..8f807d450 100755
--- a/api/src/com/cloud/vm/VirtualMachine.java
+++ b/api/src/com/cloud/vm/VirtualMachine.java
@@ -21,14 +21,15 @@
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 static StateMachine2 getStat
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 enum Event {
OperationFailedToError,
OperationRetry,
AgentReportShutdowned,
- AgentReportMigrated
+ AgentReportMigrated,
+ RevertRequested,
+ SnapshotRequested,
};
public enum Type {
@@ -239,9 +242,11 @@ public static boolean isSystemVM(VirtualMachine.Type vmtype) {
*/
public long getTemplateId();
+
+
/**
* returns the guest OS ID
- *
+ *
* @return guestOSId
*/
public long getGuestOSId();
@@ -254,7 +259,7 @@ public static boolean isSystemVM(VirtualMachine.Type vmtype) {
/**
* @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 static boolean isSystemVM(VirtualMachine.Type vmtype) {
public Date getCreated();
public long getServiceOfferingId();
+
+ public Long getDiskOfferingId();
Type getType();
@@ -287,5 +294,4 @@ public static boolean isSystemVM(VirtualMachine.Type vmtype) {
public Map getDetails();
- boolean canPlugNics();
}
diff --git a/api/src/com/cloud/vm/VirtualMachineProfile.java b/api/src/com/cloud/vm/VirtualMachineProfile.java
index 0fab44368..33a9171e7 100644
--- a/api/src/com/cloud/vm/VirtualMachineProfile.java
+++ b/api/src/com/cloud/vm/VirtualMachineProfile.java
@@ -136,4 +136,10 @@ public String getName() {
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 000000000..f0ee7ee7e
--- /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 000000000..83f86bc90
--- /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 2e2b73ba7..0d0dfd1be 100644
--- a/api/src/org/apache/cloudstack/acl/APIChecker.java
+++ b/api/src/org/apache/cloudstack/acl/APIChecker.java
@@ -17,7 +17,6 @@
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;
@@ -27,5 +26,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, RequestLimitException;
+ boolean checkAccess(User user, String apiCommandName) throws PermissionDeniedException;
}
diff --git a/api/src/org/apache/cloudstack/affinity/AffinityGroup.java b/api/src/org/apache/cloudstack/affinity/AffinityGroup.java
new file mode 100644
index 000000000..ac2eb6133
--- /dev/null
+++ b/api/src/org/apache/cloudstack/affinity/AffinityGroup.java
@@ -0,0 +1,31 @@
+// 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.affinity;
+
+import org.apache.cloudstack.acl.ControlledEntity;
+import org.apache.cloudstack.api.Identity;
+import org.apache.cloudstack.api.InternalIdentity;
+
+public interface AffinityGroup extends ControlledEntity, InternalIdentity, Identity {
+
+ String getName();
+
+ String getDescription();
+
+ String getType();
+
+}
diff --git a/api/src/org/apache/cloudstack/affinity/AffinityGroupProcessor.java b/api/src/org/apache/cloudstack/affinity/AffinityGroupProcessor.java
new file mode 100644
index 000000000..60b8e4c55
--- /dev/null
+++ b/api/src/org/apache/cloudstack/affinity/AffinityGroupProcessor.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 org.apache.cloudstack.affinity;
+
+import com.cloud.deploy.DeploymentPlan;
+import com.cloud.deploy.DeploymentPlanner.ExcludeList;
+import com.cloud.exception.AffinityConflictException;
+import com.cloud.utils.component.Adapter;
+import com.cloud.vm.VirtualMachine;
+import com.cloud.vm.VirtualMachineProfile;
+
+public interface AffinityGroupProcessor extends Adapter {
+
+ /**
+ * process() is called to apply any user preferences to the deployment plan
+ * and avoid set for the given VM placement.
+ *
+ * @param vm
+ * virtual machine.
+ * @param plan
+ * deployment plan that tells you where it's being deployed to.
+ * @param avoid
+ * avoid these data centers, pods, clusters, or hosts.
+ */
+ void process(VirtualMachineProfile extends VirtualMachine> vm, DeploymentPlan plan, ExcludeList avoid)
+ throws AffinityConflictException;
+
+ /**
+ * getType() should return the affinity/anti-affinity group being
+ * implemented
+ *
+ * @return String Affinity/Anti-affinity type
+ */
+ String getType();
+}
\ No newline at end of file
diff --git a/api/src/org/apache/cloudstack/affinity/AffinityGroupResponse.java b/api/src/org/apache/cloudstack/affinity/AffinityGroupResponse.java
new file mode 100644
index 000000000..afd33da84
--- /dev/null
+++ b/api/src/org/apache/cloudstack/affinity/AffinityGroupResponse.java
@@ -0,0 +1,155 @@
+// 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.affinity;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseResponse;
+import org.apache.cloudstack.api.EntityReference;
+import org.apache.cloudstack.api.response.ControlledEntityResponse;
+import org.apache.cloudstack.api.response.ControlledViewEntityResponse;
+import org.apache.cloudstack.api.response.UserVmResponse;
+
+import com.cloud.network.security.SecurityGroup;
+import com.cloud.serializer.Param;
+import com.google.gson.annotations.SerializedName;
+
+@SuppressWarnings("unused")
+@EntityReference(value = AffinityGroup.class)
+public class AffinityGroupResponse extends BaseResponse implements ControlledViewEntityResponse {
+
+ @SerializedName(ApiConstants.ID) @Param(description="the ID of the affinity group")
+ private String id;
+
+ @SerializedName(ApiConstants.NAME) @Param(description="the name of the affinity group")
+ private String name;
+
+ @SerializedName(ApiConstants.DESCRIPTION) @Param(description="the description of the affinity group")
+ private String description;
+
+ @SerializedName(ApiConstants.ACCOUNT) @Param(description="the account owning the affinity group")
+ private String accountName;
+
+ @SerializedName(ApiConstants.DOMAIN_ID) @Param(description="the domain ID of the affinity group")
+ private String domainId;
+
+ @SerializedName(ApiConstants.DOMAIN) @Param(description="the domain name of the affinity group")
+ private String domainName;
+
+ @SerializedName(ApiConstants.TYPE)
+ @Param(description = "the type of the affinity group")
+ private String type;
+
+ @SerializedName("virtualmachineIds")
+ @Param(description = "virtual machine Ids associated with this affinity group ")
+ private List vmIdList;
+
+ public AffinityGroupResponse() {
+ this.vmIdList = new ArrayList();
+ }
+
+ @Override
+ public String getObjectId() {
+ return this.getId();
+ }
+
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public void setAccountName(String accountName) {
+ this.accountName = accountName;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ @Override
+ public void setDomainId(String domainId) {
+ this.domainId = domainId;
+ }
+
+ public void setDomainName(String domainName) {
+ this.domainName = domainName;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((id == null) ? 0 : id.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ AffinityGroupResponse other = (AffinityGroupResponse) obj;
+ if (id == null) {
+ if (other.id != null)
+ return false;
+ } else if (!id.equals(other.id))
+ return false;
+ return true;
+ }
+
+ @Override
+ public void setProjectId(String projectId) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void setProjectName(String projectName) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void setVMIdList(List vmIdList) {
+ this.vmIdList = vmIdList;
+ }
+
+ public void addVMId(String vmId) {
+ this.vmIdList.add(vmId);
+ }
+
+}
diff --git a/api/src/org/apache/cloudstack/affinity/AffinityGroupService.java b/api/src/org/apache/cloudstack/affinity/AffinityGroupService.java
new file mode 100644
index 000000000..26c32c89c
--- /dev/null
+++ b/api/src/org/apache/cloudstack/affinity/AffinityGroupService.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.affinity;
+
+import java.util.List;
+
+import com.cloud.exception.ResourceInUseException;
+import com.cloud.uservm.UserVm;
+import com.cloud.utils.Pair;
+
+public interface AffinityGroupService {
+
+ /**
+ * Creates an affinity/anti-affinity group for the given account/domain.
+ *
+ * @param account
+ * @param domainId
+ * @param name
+ * @param type
+ * @param description
+ * @return AffinityGroup
+ */
+
+ AffinityGroup createAffinityGroup(String account, Long domainId, String affinityGroupName,
+ String affinityGroupType, String description);
+
+ /**
+ * Creates an affinity/anti-affinity group.
+ *
+ * @param affinityGroupId
+ * @param account
+ * @param domainId
+ * @param affinityGroupName
+ * @throws ResourceInUseException
+ */
+ boolean deleteAffinityGroup(Long affinityGroupId, String account, Long domainId, String affinityGroupName)
+ throws ResourceInUseException;
+
+ /** Lists Affinity Groups in your account
+ * @param account
+ * @param domainId
+ * @param affinityGroupId
+ * @param affinityGroupName
+ * @param affinityGroupType
+ * @param vmId
+ * @param startIndex
+ * @param pageSize
+ * @return
+ */
+ Pair, Integer> listAffinityGroups(Long affinityGroupId, String affinityGroupName,
+ String affinityGroupType, Long vmId, Long startIndex, Long pageSize);
+
+
+ /**
+ * List group types available in deployment
+ *
+ * @return
+ */
+ List listAffinityGroupTypes();
+
+ AffinityGroup getAffinityGroup(Long groupId);
+
+ UserVm updateVMAffinityGroups(Long vmId, List affinityGroupIds);
+
+}
diff --git a/api/src/org/apache/cloudstack/affinity/AffinityGroupTypeResponse.java b/api/src/org/apache/cloudstack/affinity/AffinityGroupTypeResponse.java
new file mode 100644
index 000000000..2d1cd25ed
--- /dev/null
+++ b/api/src/org/apache/cloudstack/affinity/AffinityGroupTypeResponse.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 org.apache.cloudstack.affinity;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseResponse;
+import org.apache.cloudstack.api.EntityReference;
+import org.apache.cloudstack.api.response.ControlledEntityResponse;
+import org.apache.cloudstack.api.response.ControlledViewEntityResponse;
+
+import com.cloud.network.security.SecurityGroup;
+import com.cloud.serializer.Param;
+import com.google.gson.annotations.SerializedName;
+
+@SuppressWarnings("unused")
+@EntityReference(value = AffinityGroup.class)
+public class AffinityGroupTypeResponse extends BaseResponse {
+
+ @SerializedName(ApiConstants.TYPE)
+ @Param(description = "the type of the affinity group")
+ private String type;
+
+
+ public AffinityGroupTypeResponse() {
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+}
diff --git a/api/src/org/apache/cloudstack/affinity/AffinityProcessorBase.java b/api/src/org/apache/cloudstack/affinity/AffinityProcessorBase.java
new file mode 100644
index 000000000..70ecd0835
--- /dev/null
+++ b/api/src/org/apache/cloudstack/affinity/AffinityProcessorBase.java
@@ -0,0 +1,44 @@
+// 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.affinity;
+
+import com.cloud.deploy.DeploymentPlan;
+import com.cloud.deploy.DeploymentPlanner.ExcludeList;
+import com.cloud.exception.AffinityConflictException;
+import com.cloud.utils.component.AdapterBase;
+import com.cloud.vm.VirtualMachine;
+import com.cloud.vm.VirtualMachineProfile;
+
+public class AffinityProcessorBase extends AdapterBase implements AffinityGroupProcessor {
+
+ protected String _type;
+
+ @Override
+ public void process(VirtualMachineProfile extends VirtualMachine> vm, DeploymentPlan plan, ExcludeList avoid)
+ throws AffinityConflictException {
+
+ }
+
+ @Override
+ public String getType() {
+ return _type;
+ }
+
+ public void setType(String type) {
+ _type = type;
+ }
+}
diff --git a/api/src/org/apache/cloudstack/api/ACL.java b/api/src/org/apache/cloudstack/api/ACL.java
index 3623d1ac5..ce93b6aa7 100644
--- a/api/src/org/apache/cloudstack/api/ACL.java
+++ b/api/src/org/apache/cloudstack/api/ACL.java
@@ -22,10 +22,14 @@
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
+import org.apache.cloudstack.acl.SecurityChecker.AccessType;
+
@Retention(RetentionPolicy.RUNTIME)
@Target({ FIELD })
public @interface ACL {
+ AccessType accessType() default AccessType.ListEntry;
+
boolean checkKeyAccess() default false;
boolean checkValueAccess() default false;
}
diff --git a/api/src/org/apache/cloudstack/api/ApiConstants.java b/api/src/org/apache/cloudstack/api/ApiConstants.java
index 6d2a9a312..37cb59f37 100755
--- 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";
@@ -47,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";
@@ -59,6 +59,8 @@ 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";
@@ -78,6 +80,10 @@ public class ApiConstants {
public static final String IP6_GATEWAY = "ip6gateway";
public static final String GROUP = "group";
public static final String GROUP_ID = "groupid";
+ public static final String GSLB_LB_METHOD = "gslblbmethod";
+ public static final String GSLB_SERVICE_DOMAIN_NAME = "gslbdomainname";
+ public static final String GSLB_SERVICE_TYPE = "gslbservicetype";
+ public static final String GSLB_STICKY_SESSION_METHOD = "gslbstickysessionmethodname";
public static final String GUEST_CIDR_ADDRESS = "guestcidraddress";
public static final String HA_ENABLE = "haenable";
public static final String HOST_ID = "hostid";
@@ -103,6 +109,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";
@@ -119,6 +126,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";
@@ -218,6 +226,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";
@@ -324,6 +333,7 @@ public class ApiConstants {
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 LOAD_BALANCER_RULE_LIST = "loadbalancerrulelist";
public static final String FIREWALL_DEVICE_ID = "fwdeviceid";
public static final String FIREWALL_DEVICE_NAME = "fwdevicename";
public static final String FIREWALL_DEVICE_STATE = "fwdevicestate";
@@ -355,7 +365,10 @@ public class ApiConstants {
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 VSWITCH_TYPE_GUEST_TRAFFIC = "guestvswitchtype";
+ public static final String VSWITCH_TYPE_PUBLIC_TRAFFIC = "publicvswitchtype";
+ public static final String VSWITCH_NAME_GUEST_TRAFFIC = "guestvswitchname";
+ public static final String VSWITCH_NAME_PUBLIC_TRAFFIC = "publicvswitchname";
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";
@@ -374,6 +387,8 @@ 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 VPC_OFF_ID = "vpcofferingid";
public static final String NETWORK = "network";
public static final String VPC_ID = "vpcid";
@@ -434,13 +449,41 @@ public class ApiConstants {
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 GSLB_PROVIDER = "gslbprovider";
+ public static final String GSLB_PROVIDER_PUBLIC_IP = "gslbproviderpublicip";
+ public static final String GSLB_PROVIDER_PRIVATE_IP = "gslbproviderprivateip";
+ 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 UCS_MANAGER_ID = "ucsmanagerid";
+ public static final String UCS_PROFILE_DN = "profiledn";
+ public static final String UCS_BLADE_DN = "bladedn";
+ public static final String UCS_BLADE_ID = "bladeid";
+ public static final String VM_GUEST_IP = "vmguestip";
+ public static final String OLDER_THAN = "olderthan";
+ public static final String HEALTHCHECK_RESPONSE_TIMEOUT = "responsetimeout";
+ public static final String HEALTHCHECK_INTERVAL_TIME = "intervaltime";
+ public static final String HEALTHCHECK_HEALTHY_THRESHOLD = "healthythreshold";
+ public static final String HEALTHCHECK_UNHEALTHY_THRESHOLD = "unhealthythreshold";
+ public static final String HEALTHCHECK_PINGPATH = "pingpath";
+ public static final String AFFINITY_GROUP_IDS = "affinitygroupids";
+ public static final String AFFINITY_GROUP_NAMES = "affinitygroupnames";
+ public static final String DEPLOYMENT_PLANNER = "deploymentplanner";
+ public static final String ASA_INSIDE_PORT_PROFILE = "insideportprofile";
public enum HostDetails {
all, capacity, events, stats, min;
}
public enum VMDetails {
- all, group, nics, stats, secgrp, tmpl, servoff, iso, volume, min;
+ all, group, nics, stats, secgrp, tmpl, servoff, iso, volume, min, affgrp;
}
public enum LDAPParams {
diff --git a/api/src/org/apache/cloudstack/api/ApiErrorCode.java b/api/src/org/apache/cloudstack/api/ApiErrorCode.java
index ee28fa058..69bd0284c 100644
--- a/api/src/org/apache/cloudstack/api/ApiErrorCode.java
+++ b/api/src/org/apache/cloudstack/api/ApiErrorCode.java
@@ -18,7 +18,6 @@
/**
* Enum class for various API error code used in CloudStack
- * @author minc
*
*/
public enum ApiErrorCode {
diff --git a/api/src/org/apache/cloudstack/api/BaseAsyncCmd.java b/api/src/org/apache/cloudstack/api/BaseAsyncCmd.java
index fd67ed896..f3b317044 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;
@@ -30,6 +31,7 @@ public abstract class BaseAsyncCmd extends BaseCmd {
public static final String networkSyncObject = "network";
public static final String vpcSyncObject = "vpc";
public static final String snapshotHostSyncObject = "snapshothost";
+ public static final String gslbSyncObject = "globalserverloadbalacner";
private AsyncJob job;
diff --git a/api/src/org/apache/cloudstack/api/BaseCmd.java b/api/src/org/apache/cloudstack/api/BaseCmd.java
index 966e39cc1..42c0680ce 100644
--- a/api/src/org/apache/cloudstack/api/BaseCmd.java
+++ b/api/src/org/apache/cloudstack/api/BaseCmd.java
@@ -25,11 +25,14 @@
import java.util.Map;
import java.util.regex.Pattern;
+import javax.inject.Inject;
+
+import org.apache.cloudstack.affinity.AffinityGroupService;
import org.apache.cloudstack.query.QueryService;
+import org.apache.cloudstack.usage.UsageService;
import org.apache.log4j.Logger;
import com.cloud.configuration.ConfigurationService;
-import com.cloud.consoleproxy.ConsoleProxyService;
import com.cloud.dao.EntityManager;
import com.cloud.domain.Domain;
import com.cloud.exception.ConcurrentOperationException;
@@ -40,6 +43,7 @@
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;
@@ -48,6 +52,7 @@
import com.cloud.network.lb.LoadBalancingRulesService;
import com.cloud.network.rules.RulesService;
import com.cloud.network.security.SecurityGroupService;
+import com.cloud.network.vpc.VpcProvisioningService;
import com.cloud.network.vpc.VpcService;
import com.cloud.network.vpn.RemoteAccessVpnService;
import com.cloud.network.vpn.Site2SiteVpnService;
@@ -56,7 +61,9 @@
import com.cloud.resource.ResourceService;
import com.cloud.server.ManagementService;
import com.cloud.server.TaggedResourceService;
+import com.cloud.storage.DataStoreProviderApiService;
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 +71,8 @@
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());
@@ -92,75 +98,48 @@ public enum CommandType {
@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;
-
- 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 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 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;
+
+ @Inject public QueryService _queryService;
+ @Inject public UsageService _usageService;
+ @Inject public NetworkUsageService _networkUsageService;
+ @Inject public VMSnapshotService _vmSnapshotService;
+ @Inject public DataStoreProviderApiService dataStoreProviderApiService;
+ @Inject public VpcProvisioningService _vpcProvSvc;
+ @Inject public AffinityGroupService _affinityGroupService;
public abstract void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException, NetworkRuleConflictException;
+ public void configure() {
+ }
+
public String getResponseType() {
if (responseType == null) {
return RESPONSE_TYPE_XML;
diff --git a/api/src/org/apache/cloudstack/api/BaseListCmd.java b/api/src/org/apache/cloudstack/api/BaseListCmd.java
index 58e83f709..bc0b2b8f3 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 Integer getPageSize() {
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 cde2d9486..47aa67919 100644
--- a/api/src/org/apache/cloudstack/api/BaseListTemplateOrIsoPermissionsCmd.java
+++ b/api/src/org/apache/cloudstack/api/BaseListTemplateOrIsoPermissionsCmd.java
@@ -18,9 +18,9 @@
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 01f1be325..187ad9456 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
index dd6ae007a..6fd977311 100644
--- 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.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
index 3222c710c..5cd4881e2 100644
--- a/api/src/org/apache/cloudstack/api/BaseUpdateTemplateOrIsoPermissionsCmd.java
+++ b/api/src/org/apache/cloudstack/api/BaseUpdateTemplateOrIsoPermissionsCmd.java
@@ -19,10 +19,10 @@
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 {
diff --git a/api/src/org/apache/cloudstack/api/PlugService.java b/api/src/org/apache/cloudstack/api/PlugService.java
deleted file mode 100644
index 00032e3ab..000000000
--- a/api/src/org/apache/cloudstack/api/PlugService.java
+++ /dev/null
@@ -1,31 +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 org.apache.cloudstack.api;
-
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-import com.cloud.utils.component.PluggableService;
-
-@Target(FIELD)
-@Retention(RUNTIME)
-public @interface PlugService {
- Class extends PluggableService> pluggableService() default PluggableService.class;
-}
diff --git a/api/src/org/apache/cloudstack/api/ResponseGenerator.java b/api/src/org/apache/cloudstack/api/ResponseGenerator.java
index 63df4dc55..c0dd57e15 100644
--- a/api/src/org/apache/cloudstack/api/ResponseGenerator.java
+++ b/api/src/org/apache/cloudstack/api/ResponseGenerator.java
@@ -20,6 +20,8 @@
import java.util.EnumSet;
import java.util.List;
+import org.apache.cloudstack.affinity.AffinityGroup;
+import org.apache.cloudstack.affinity.AffinityGroupResponse;
import org.apache.cloudstack.api.ApiConstants.HostDetails;
import org.apache.cloudstack.api.ApiConstants.VMDetails;
import org.apache.cloudstack.api.command.user.job.QueryAsyncJobResultCmd;
@@ -47,12 +49,15 @@
import org.apache.cloudstack.api.response.IPAddressResponse;
import org.apache.cloudstack.api.response.InstanceGroupResponse;
import org.apache.cloudstack.api.response.IpForwardingRuleResponse;
+import org.apache.cloudstack.api.response.LBHealthCheckResponse;
import org.apache.cloudstack.api.response.LBStickinessResponse;
import org.apache.cloudstack.api.response.LDAPConfigResponse;
import org.apache.cloudstack.api.response.LoadBalancerResponse;
import org.apache.cloudstack.api.response.NetworkACLResponse;
import org.apache.cloudstack.api.response.NetworkOfferingResponse;
import org.apache.cloudstack.api.response.NetworkResponse;
+import org.apache.cloudstack.api.response.NicResponse;
+import org.apache.cloudstack.api.response.NicSecondaryIpResponse;
import org.apache.cloudstack.api.response.PhysicalNetworkResponse;
import org.apache.cloudstack.api.response.PodResponse;
import org.apache.cloudstack.api.response.PrivateGatewayResponse;
@@ -60,10 +65,12 @@
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 +88,12 @@
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 +101,8 @@
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;
@@ -107,25 +117,12 @@
import com.cloud.event.Event;
import com.cloud.host.Host;
import com.cloud.hypervisor.HypervisorCapabilities;
-import com.cloud.network.IpAddress;
-import com.cloud.network.Network;
+import com.cloud.network.*;
import com.cloud.network.Network.Service;
-import com.cloud.network.PhysicalNetwork;
-import com.cloud.network.PhysicalNetworkServiceProvider;
-import com.cloud.network.PhysicalNetworkTrafficType;
-import com.cloud.network.RemoteAccessVpn;
-import com.cloud.network.Site2SiteCustomerGateway;
-import com.cloud.network.Site2SiteVpnConnection;
-import com.cloud.network.Site2SiteVpnGateway;
-import com.cloud.network.VirtualRouterProvider;
-import com.cloud.network.VpnUser;
-import com.cloud.network.as.AutoScalePolicy;
-import com.cloud.network.as.AutoScaleVmGroup;
-import com.cloud.network.as.AutoScaleVmProfile;
-import com.cloud.network.as.Condition;
-import com.cloud.network.as.Counter;
+import com.cloud.network.as.*;
import com.cloud.network.router.VirtualRouter;
import com.cloud.network.rules.FirewallRule;
+import com.cloud.network.rules.HealthCheckPolicy;
import com.cloud.network.rules.LoadBalancer;
import com.cloud.network.rules.PortForwardingRule;
import com.cloud.network.rules.StaticNatRule;
@@ -143,13 +140,9 @@
import com.cloud.projects.Project;
import com.cloud.projects.ProjectAccount;
import com.cloud.projects.ProjectInvitation;
+import com.cloud.region.ha.GlobalLoadBalancerRule;
import com.cloud.server.ResourceTag;
-import com.cloud.storage.GuestOS;
-import com.cloud.storage.S3;
-import com.cloud.storage.Snapshot;
-import com.cloud.storage.StoragePool;
-import com.cloud.storage.Swift;
-import com.cloud.storage.Volume;
+import com.cloud.storage.*;
import com.cloud.storage.snapshot.SnapshotPolicy;
import com.cloud.storage.snapshot.SnapshotSchedule;
import com.cloud.template.VirtualMachineTemplate;
@@ -158,7 +151,10 @@
import com.cloud.user.UserAccount;
import com.cloud.uservm.UserVm;
import com.cloud.vm.InstanceGroup;
+import com.cloud.vm.Nic;
+import com.cloud.vm.snapshot.VMSnapshot;
import com.cloud.vm.VirtualMachine;
+import org.apache.cloudstack.api.response.*;
public interface ResponseGenerator {
UserResponse createUserResponse(UserAccount user);
@@ -197,12 +193,19 @@ public interface ResponseGenerator {
IPAddressResponse createIPAddressResponse(IpAddress ipAddress);
+ GlobalLoadBalancerResponse createGlobalLoadBalancerResponse(GlobalLoadBalancerRule globalLoadBalancerRule);
+
LoadBalancerResponse createLoadBalancerResponse(LoadBalancer loadBalancer);
LBStickinessResponse createLBStickinessPolicyResponse(List extends StickinessPolicy> stickinessPolicies, LoadBalancer lb);
LBStickinessResponse createLBStickinessPolicyResponse(StickinessPolicy stickinessPolicy, LoadBalancer lb);
+ LBHealthCheckResponse createLBHealthCheckPolicyResponse(List extends HealthCheckPolicy> healthcheckPolicies,
+ LoadBalancer lb);
+
+ LBHealthCheckResponse createLBHealthCheckPolicyResponse(HealthCheckPolicy healthcheckPolicy, LoadBalancer lb);
+
PodResponse createPodResponse(Pod pod, Boolean showCapacities);
ZoneResponse createZoneResponse(DataCenter dataCenter, Boolean showCapacities);
@@ -314,6 +317,8 @@ public interface ResponseGenerator {
StorageNetworkIpRangeResponse createStorageNetworkIpRangeResponse(StorageNetworkIpRange result);
+ RegionResponse createRegionResponse(Region region);
+
/**
* @param resourceTag
* @param keyValueOnly TODO
@@ -372,4 +377,17 @@ public interface ResponseGenerator {
GuestOSResponse createGuestOSResponse(GuestOS os);
SnapshotScheduleResponse createSnapshotScheduleResponse(SnapshotSchedule sched);
+
+ UsageRecordResponse createUsageResponse(Usage usageRecord);
+
+ TrafficMonitorResponse createTrafficMonitorResponse(Host trafficMonitor);
+ VMSnapshotResponse createVMSnapshotResponse(VMSnapshot vmSnapshot);
+
+ NicSecondaryIpResponse createSecondaryIPToNicResponse(String ip,
+ Long nicId, Long networkId);
+ public NicResponse createNicResponse(Nic result);
+
+ AffinityGroupResponse createAffinityGroupResponse(AffinityGroup group);
+
+ Long getAffinityGroupId(String name, long entityOwnerId);
}
diff --git a/api/src/org/apache/cloudstack/api/ServerApiException.java b/api/src/org/apache/cloudstack/api/ServerApiException.java
index 682e5b7e7..4b0fae585 100644
--- a/api/src/org/apache/cloudstack/api/ServerApiException.java
+++ b/api/src/org/apache/cloudstack/api/ServerApiException.java
@@ -43,7 +43,7 @@ public ServerApiException(ApiErrorCode errorCode, String description, Throwable
super(description, cause);
_errorCode = errorCode;
_description = description;
- if (cause instanceof CloudRuntimeException || cause instanceof CloudException ) {
+ if (cause instanceof CloudRuntimeException) {
CloudRuntimeException rt = (CloudRuntimeException) cause;
ArrayList idList = rt.getIdProxyList();
if (idList != null) {
@@ -52,6 +52,15 @@ public ServerApiException(ApiErrorCode errorCode, String description, Throwable
}
}
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());
}
}
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 a13cf6253..95d0d07d9 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 @@
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;
@@ -59,7 +63,7 @@ public class CreateAccountCmd extends BaseCmd {
@Parameter(name=ApiConstants.LASTNAME, type=CommandType.STRING, required=true, description="lastname")
private String lastName;
- @Parameter(name=ApiConstants.PASSWORD, type=CommandType.STRING, required=true, description="Hashed password (Default is MD5). If you wish to use any other hashing algorithm, you would need to write a custom authentication adapter See Docs section.")
+ @Parameter(name=ApiConstants.PASSWORD, type=CommandType.STRING, required=true, description="Clear text password (Default hashed to SHA256SALT). If you wish to use any other hashing algorithm, you would need to write a custom authentication adapter See Docs section.")
private String password;
@Parameter(name=ApiConstants.TIMEZONE, type=CommandType.STRING, description="Specifies a timezone for this command. For more information on the timezone parameter, see Time Zone Format.")
@@ -74,6 +78,12 @@ 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.ACCOUNT_ID, type=CommandType.STRING, description="Account UUID, required for adding account from external provisioning system")
+ private String accountUUID;
+
+ @Parameter(name=ApiConstants.USER_ID, type=CommandType.STRING, description="User UUID, required for adding account from external provisioning system")
+ private String userUUID;
+
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
@@ -128,6 +138,14 @@ public Map getDetails() {
return params;
}
+ public String getAccountUUID() {
+ return accountUUID;
+ }
+
+ public String getUserUUID() {
+ return userUUID;
+ }
+
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
@@ -145,7 +163,8 @@ public long getEntityOwnerId() {
@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());
if (userAccount != null) {
AccountResponse response = _responseGenerator.createUserAccountResponse(userAccount);
response.setResponseName(getCommandName());
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 86ccb4ba2..9895da113 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,10 +48,13 @@ public class DeleteAccountCmd extends BaseAsyncCmd {
required=true, description="Account id")
private Long id;
+ @Inject RegionService _regionService;
+
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
+
public Long getId() {
return id;
}
@@ -86,7 +96,8 @@ public String getEventDescription() {
@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);
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 318dfda7d..1f9b8217d 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,8 @@ 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;
+ @Inject RegionService _regionService;
+
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
@@ -68,6 +76,10 @@ public Long getDomainId() {
return domainId;
}
+ public Boolean getLockRequested() {
+ return lockRequested;
+ }
+
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
@@ -105,11 +117,7 @@ public String getEventDescription() {
@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());
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 2688ef151..b9a9f6d70 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,16 +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.APICommand;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.ApiErrorCode;
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.AccountResponse;
import org.apache.cloudstack.api.response.DomainResponse;
+import org.apache.cloudstack.region.RegionService;
+import org.apache.log4j.Logger;
import com.cloud.user.Account;
@@ -48,6 +50,8 @@ public class EnableAccountCmd extends BaseCmd {
description="Enables specified account in this domain.")
private Long domainId;
+ @Inject RegionService _regionService;
+
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
@@ -90,7 +94,7 @@ public long getEntityOwnerId() {
@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());
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 c67e84632..f4aa3afa8 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;
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 ea6d9078e..60d1a97ff 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,16 +19,18 @@
import java.util.Collection;
import java.util.Map;
-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.APICommand;
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;
@@ -61,6 +63,8 @@ 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;
+ @Inject RegionService _regionService;
+
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
@@ -120,7 +124,7 @@ public long getEntityOwnerId() {
@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());
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 8c9872280..98ffc51f7 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,16 +17,15 @@
package org.apache.cloudstack.api.command.admin.autoscale;
-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.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.CounterResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.async.AsyncJob;
import com.cloud.event.EventTypes;
import com.cloud.network.as.Counter;
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 2fde06176..35d99bbc9 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,17 +17,16 @@
package org.apache.cloudstack.api.command.admin.autoscale;
-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.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.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;
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 c64883c16..d55ccd7dd 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 @@
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,40 @@ 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;
+
+ @Parameter(name = ApiConstants.VSWITCH_TYPE_GUEST_TRAFFIC, type = CommandType.STRING, required = false, description = "Type of virtual switch used for guest traffic in the cluster. Allowed values are, vmwaresvs (for VMware standard vSwitch) and vmwaredvs (for VMware distributed vSwitch)")
+ private String vSwitchTypeGuestTraffic;
+
+ @Parameter(name = ApiConstants.VSWITCH_TYPE_PUBLIC_TRAFFIC, type = CommandType.STRING, required = false, description = "Type of virtual switch used for public traffic in the cluster. Allowed values are, vmwaresvs (for VMware standard vSwitch) and vmwaredvs (for VMware distributed vSwitch)")
+ private String vSwitchTypePublicTraffic;
+
+ @Parameter(name = ApiConstants.VSWITCH_TYPE_GUEST_TRAFFIC, type = CommandType.STRING, required = false, description = "Name of virtual switch used for guest traffic in the cluster. This would override zone wide traffic label setting.")
+ private String vSwitchNameGuestTraffic;
+
+ @Parameter(name = ApiConstants.VSWITCH_TYPE_PUBLIC_TRAFFIC, type = CommandType.STRING, required = false, description = "Name of virtual switch used for public traffic in the cluster. This would override zone wide traffic label setting.")
+ private String vSwitchNamePublicTraffic;
+
+ public String getVSwitchTypeGuestTraffic() {
+ return vSwitchTypeGuestTraffic;
+ }
+
+ public String getVSwitchTypePublicTraffic() {
+ return vSwitchTypePublicTraffic;
+ }
+
+ public String getVSwitchNameGuestTraffic() {
+ return vSwitchNameGuestTraffic;
+ }
+
+ public String getVSwitchNamePublicTraffic() {
+ return vSwitchNamePublicTraffic;
+ }
+
public String getVSMIpaddress() {
return vsmipaddress;
}
@@ -144,9 +185,26 @@ public void setAllocationState(String allocationState) {
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();
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 93103d3f6..4fece0c7a 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,16 +16,16 @@
// under the License.
package org.apache.cloudstack.api.command.admin.cluster;
-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.APICommand;
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)
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 95ab0bff4..0417b187e 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 @@
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 d6ec7188d..c5130587e 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,15 +16,15 @@
// under the License.
package org.apache.cloudstack.api.command.admin.cluster;
-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.APICommand;
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;
@@ -54,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;
}
@@ -100,14 +107,39 @@ public void setManagedstate(String managedstate) {
this.managedState = managedstate;
}
+ public Float getCpuOvercommitRatio (){
+ if(cpuovercommitratio != null){
+ return Float.parseFloat(cpuovercommitratio);
+ }
+ return null;
+ }
+
+ public Float getMemoryOvercommitRaito (){
+ if (memoryovercommitratio != null){
+ return Float.parseFloat(memoryovercommitratio);
+ }
+ return null;
+ }
+
@Override
public void execute(){
Cluster cluster = _resourceService.getCluster(getId());
if (cluster == null) {
throw new InvalidParameterValueException("Unable to find the cluster by id=" + getId());
}
+ if (getMemoryOvercommitRaito() !=null){
+ if ((getMemoryOvercommitRaito().compareTo(1f) < 0)) {
+ throw new InvalidParameterValueException("Memory overcommit ratio should be greater than or equal to one");
+ }
+ }
+
+ if (getCpuOvercommitRatio() !=null){
+ if (getCpuOvercommitRatio().compareTo(1f) < 0) {
+ throw new InvalidParameterValueException("Cpu overcommit ratio should be greater than or equal to one");
+ }
+ }
- Cluster result = _resourceService.updateCluster(cluster, getClusterType(), getHypervisor(), getAllocationState(), getManagedstate());
+ Cluster result = _resourceService.updateCluster(cluster, getClusterType(), getHypervisor(), getAllocationState(), getManagedstate(), getMemoryOvercommitRaito(), getCpuOvercommitRatio());
if (result != null) {
ClusterResponse clusterResponse = _responseGenerator.createClusterResponse(cluster, false);
clusterResponse.setResponseName(getCommandName());
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 16010fdb4..aabfd4a62 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.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/ListDeploymentPlannersCmd.java b/api/src/org/apache/cloudstack/api/command/admin/config/ListDeploymentPlannersCmd.java
new file mode 100644
index 000000000..69004de2a
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/admin/config/ListDeploymentPlannersCmd.java
@@ -0,0 +1,71 @@
+// 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.config;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.BaseListCmd;
+import org.apache.cloudstack.api.response.DeploymentPlannersResponse;
+import org.apache.cloudstack.api.response.ListResponse;
+import org.apache.log4j.Logger;
+
+@APICommand(name = "listDeploymentPlanners", description = "Lists all DeploymentPlanners available.", responseObject = DeploymentPlannersResponse.class)
+public class ListDeploymentPlannersCmd extends BaseListCmd {
+ public static final Logger s_logger = Logger.getLogger(ListDeploymentPlannersCmd.class.getName());
+
+ private static final String s_name = "listdeploymentplannersresponse";
+
+ /////////////////////////////////////////////////////
+ //////////////// API parameters /////////////////////
+ /////////////////////////////////////////////////////
+
+
+ /////////////////////////////////////////////////////
+ /////////////////// Accessors ///////////////////////
+ /////////////////////////////////////////////////////
+
+
+ /////////////////////////////////////////////////////
+ /////////////// API Implementation///////////////////
+ /////////////////////////////////////////////////////
+
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
+
+ @Override
+ public void execute(){
+ List planners = _mgr.listDeploymentPlanners();
+ ListResponse response = new ListResponse();
+ List plannerResponses = new ArrayList();
+
+ for (String planner : planners) {
+ DeploymentPlannersResponse plannerResponse = new DeploymentPlannersResponse();
+ plannerResponse.setName(planner);
+ plannerResponse.setObjectName("deploymentPlanner");
+ plannerResponses.add(plannerResponse);
+ }
+
+ response.setResponses(plannerResponses);
+ response.setResponseName(getCommandName());
+ this.setResponseObject(response);
+
+ }
+}
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 b69e9eab5..f22202715 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.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 1c435178e..ffeb58621 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,15 +16,15 @@
// under the License.
package org.apache.cloudstack.api.command.admin.config;
-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.APICommand;
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;
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 19587f448..e2fe8a7b1 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,16 +16,16 @@
// under the License.
package org.apache.cloudstack.api.command.admin.config;
-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.APICommand;
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;
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 61614d171..91d61ccf5 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.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.log4j.Logger;
+
import com.cloud.domain.Domain;
import com.cloud.user.Account;
import com.cloud.user.UserContext;
@@ -45,6 +49,9 @@ 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;
+
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
@@ -61,6 +68,10 @@ public String getNetworkDomain() {
return networkDomain;
}
+ public String getDomainUUID() {
+ return domainUUID;
+ }
+
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
@@ -78,7 +89,7 @@ public long getEntityOwnerId() {
@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());
if (domain != null) {
DomainResponse response = _responseGenerator.createDomainResponse(domain);
response.setResponseName(getCommandName());
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 3fda9608c..488a758ca 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,6 +50,7 @@ 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;
+ @Inject RegionService _regionService;
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
@@ -88,7 +96,7 @@ public String getEventDescription() {
@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);
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 4bc05d1c0..26d8bbf64 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 @@
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 9b9e200ab..ed1419449 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 @@
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 607120c18..e658f49ad 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,8 @@ 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;
+ @Inject RegionService _regionService;
+
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
@@ -77,7 +87,8 @@ public long getEntityOwnerId() {
@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());
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 77296c72a..3a2f41447 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,12 +19,10 @@
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.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.ClusterResponse;
@@ -32,6 +30,8 @@
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;
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 3bcee8111..f1d12b3b0 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 @@
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;
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 8c617c03c..d9e593462 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,16 +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.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.HostResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.async.AsyncJob;
import com.cloud.event.EventTypes;
import com.cloud.host.Host;
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 c2b731b84..e1cef62e9 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,16 +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.APICommand;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.ApiErrorCode;
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.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)
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 876da9a6b..29844c311 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.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.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;
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 80b53aa13..c1a83fabe 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,16 +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.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.HostResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.async.AsyncJob;
import com.cloud.event.EventTypes;
import com.cloud.host.Host;
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 f42ec4b48..b151865ba 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,16 +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.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.HostResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.async.AsyncJob;
import com.cloud.event.EventTypes;
import com.cloud.host.Host;
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 c1e374e03..3bf95dbea 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,16 +18,16 @@
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.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.GuestOSCategoryResponse;
import org.apache.cloudstack.api.response.HostResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.host.Host;
import com.cloud.user.Account;
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 dd9e4559b..c4420bd13 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 b71ba7340..2976de4bf 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 @@
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 String getBindDN() {
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 void execute() throws ResourceUnavailableException,
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 6bf5f4ff8..5159fbadb 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 @@
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 b8f98021c..498325538 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,24 +18,24 @@
import java.util.Map;
-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.APICommand;
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)
@@ -47,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;
@@ -64,11 +65,8 @@ public Map getParamList() {
@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");
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 22802f936..2c6cc609e 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,17 +18,16 @@
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.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.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;
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 9d3ceb828..b48bf9e76 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.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.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;
@@ -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 Boolean getConserveMode() {
return conserveMode;
}
+ public Boolean getIsPersistent() {
+ return isPersistent == null ? false : isPersistent;
+ }
+
public Map> getServiceProviders() {
Map> serviceProviderMap = null;
if (serviceProviderList != null && !serviceProviderList.isEmpty()) {
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 1b83a9114..fb6db61f9 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,18 +18,17 @@
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.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.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;
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 59db3eb17..008fa329f 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,17 +16,16 @@
// under the License.
package org.apache.cloudstack.api.command.admin.network;
-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.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.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;
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 4d8d18e59..2ca618cd1 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,24 +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.APICommand;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.ApiErrorCode;
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.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)
@@ -41,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 /////////////////////
/////////////////////////////////////////////////////
@@ -55,11 +57,8 @@ public Long getId() {
@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());
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 69f24b419..69f34e871 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,16 +16,16 @@
// under the License.
package org.apache.cloudstack.api.command.admin.network;
-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.APICommand;
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")
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 f0d2a128a..cbcf29b8f 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,17 +16,16 @@
// under the License.
package org.apache.cloudstack.api.command.admin.network;
-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.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.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;
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 178ccb8e0..c7dd93c88 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;
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 5fa26f69a..b2dcfa52e 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;
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 11e74fbb8..0b7836de3 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,26 +20,25 @@
import java.util.List;
import java.util.Map;
-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.BaseListCmd;
-import org.apache.cloudstack.api.APICommand;
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)
@@ -47,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 /////////////////////
/////////////////////////////////////////////////////
@@ -67,11 +67,8 @@ public Map getParamList() {
@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();
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 06a0518af..e51c47eb6 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 @@
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 3331d4810..f7794c306 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,18 +19,17 @@
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.APICommand;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.ApiErrorCode;
-import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.BaseListCmd;
-import org.apache.cloudstack.api.APICommand;
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;
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 b5045bb99..46af6a690 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 @@
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.response.PodResponse;
-import org.apache.cloudstack.api.response.ZoneResponse;
+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 com.cloud.dc.StorageNetworkIpRange;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientCapacityException;
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 f7407a108..85ae13950 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.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 ca4709deb..ba685a949 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.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.NetworkOfferingResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.offering.NetworkOffering;
import com.cloud.user.Account;
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 d64fd0796..4364b2d7a 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,16 +18,15 @@
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.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.ProviderResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.async.AsyncJob;
import com.cloud.event.EventTypes;
import com.cloud.network.PhysicalNetworkServiceProvider;
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 d9a3e044c..06cf38dba 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 @@
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 d49d3c4e9..613e4c011 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.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.log4j.Logger;
+
import com.cloud.dc.StorageNetworkIpRange;
import com.cloud.event.EventTypes;
import com.cloud.exception.ConcurrentOperationException;
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 6c3630690..68d5dd466 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,16 +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.APICommand;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.ApiErrorCode;
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.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;
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 54151fe13..74392cd42 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,16 +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.APICommand;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.ApiErrorCode;
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.ServiceOfferingResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.offering.ServiceOffering;
import com.cloud.user.Account;
@@ -59,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;
@@ -81,6 +84,9 @@ public class CreateServiceOfferingCmd extends BaseCmd {
@Parameter(name=ApiConstants.NETWORKRATE, type=CommandType.INTEGER, description="data transfer rate in megabits per second allowed. Supported only for non-System offering and system offerings having \"domainrouter\" systemvmtype")
private Integer networkRate;
+ @Parameter(name = ApiConstants.DEPLOYMENT_PLANNER, type = CommandType.STRING, description = "The deployment planner heuristics used to deploy a VM of this offering, default \"FirstFitPlanner\".")
+ private String deploymentPlanner;
+
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
@@ -106,11 +112,15 @@ public String getServiceOfferingName() {
}
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() {
@@ -141,6 +151,10 @@ public Integer getNetworkRate() {
return networkRate;
}
+ public String getDeploymentPlanner() {
+ return deploymentPlanner;
+ }
+
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
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 3f854637b..f8e27fb57 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,16 +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.APICommand;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.ApiErrorCode;
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.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)
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 0a8949b90..e3664deee 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)
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 734b18bfb..1e421a13d 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,15 +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.APICommand;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.ApiErrorCode;
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.DiskOfferingResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.offering.DiskOffering;
import com.cloud.user.Account;
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 9dddd7d67..a8de07418 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.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.ServiceOfferingResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.offering.ServiceOffering;
import com.cloud.user.Account;
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 95d9e53be..a110b5002 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;
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 4080a7c46..f663633a6 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,16 +16,15 @@
// under the License.
package org.apache.cloudstack.api.command.admin.pod;
-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.APICommand;
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;
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 a64ecdde9..3dace4244 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.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 c99da9d81..a71c36242 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;
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 000000000..dce1e8b80
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/admin/region/AddRegionCmd.java
@@ -0,0 +1,95 @@
+// 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;
+
+ @Inject public RegionService _regionService;
+
+ /////////////////////////////////////////////////////
+ /////////////////// Accessors ///////////////////////
+ /////////////////////////////////////////////////////
+
+ public Integer getId() {
+ return id;
+ }
+
+ public String getRegionName() {
+ return regionName;
+ }
+
+ public String getEndPoint() {
+ return endPoint;
+ }
+
+ /////////////////////////////////////////////////////
+ /////////////// 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());
+ 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 000000000..d2b696d2b
--- /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 = "removeregionresponse";
+
+ /////////////////////////////////////////////////////
+ //////////////// 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 000000000..79890d00e
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/admin/region/UpdateRegionCmd.java
@@ -0,0 +1,95 @@
+// 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;
+
+ @Inject RegionService _regionService;
+
+ /////////////////////////////////////////////////////
+ /////////////////// Accessors ///////////////////////
+ /////////////////////////////////////////////////////
+
+ public Integer getId() {
+ return id;
+ }
+
+ public String getRegionName() {
+ return regionName;
+ }
+
+ public String getEndPoint() {
+ return endPoint;
+ }
+
+ /////////////////////////////////////////////////////
+ /////////////// 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());
+ 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/ArchiveAlertsCmd.java b/api/src/org/apache/cloudstack/api/command/admin/resource/ArchiveAlertsCmd.java
new file mode 100644
index 000000000..2a1a47a13
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/admin/resource/ArchiveAlertsCmd.java
@@ -0,0 +1,100 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.api.command.admin.resource;
+
+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.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.AlertResponse;
+import org.apache.cloudstack.api.response.ConditionResponse;
+import org.apache.cloudstack.api.response.SuccessResponse;
+import org.apache.log4j.Logger;
+
+import com.cloud.exception.InvalidParameterValueException;
+import com.cloud.user.Account;
+
+@APICommand(name = "archiveAlerts", description = "Archive one or more alerts.", responseObject = SuccessResponse.class)
+public class ArchiveAlertsCmd extends BaseCmd {
+
+ public static final Logger s_logger = Logger.getLogger(ArchiveAlertsCmd.class.getName());
+
+ private static final String s_name = "archivealertsresponse";
+
+ // ///////////////////////////////////////////////////
+ // ////////////// API parameters /////////////////////
+ // ///////////////////////////////////////////////////
+
+ @Parameter(name = ApiConstants.IDS, type = CommandType.LIST, collectionType = CommandType.UUID, entityType = AlertResponse.class,
+ description = "the IDs of the alerts")
+ private List ids;
+
+ @Parameter(name=ApiConstants.OLDER_THAN, type=CommandType.DATE, description="archive alerts older than this date (use format \"yyyy-MM-dd\")")
+ private Date olderThan;
+
+ @Parameter(name = ApiConstants.TYPE, type = CommandType.STRING, description = "archive by alert type")
+ private String type;
+
+ // ///////////////////////////////////////////////////
+ // ///////////////// Accessors ///////////////////////
+ // ///////////////////////////////////////////////////
+
+ public List getIds() {
+ return ids;
+ }
+
+ public Date getOlderThan() {
+ return olderThan;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ // ///////////////////////////////////////////////////
+ // ///////////// API Implementation///////////////////
+ // ///////////////////////////////////////////////////
+
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
+
+ @Override
+ public long getEntityOwnerId() {
+ return Account.ACCOUNT_ID_SYSTEM;
+ }
+
+ @Override
+ public void execute() {
+ if(ids == null && type == null && olderThan == null) {
+ throw new InvalidParameterValueException("either ids, type or olderthan must be specified");
+ }
+ boolean result = _mgr.archiveAlerts(this);
+ if (result) {
+ SuccessResponse response = new SuccessResponse(getCommandName());
+ this.setResponseObject(response);
+ } else {
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Unable to archive Alerts, one or more parameters has invalid values");
+ }
+ }
+}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/resource/DeleteAlertsCmd.java b/api/src/org/apache/cloudstack/api/command/admin/resource/DeleteAlertsCmd.java
new file mode 100644
index 000000000..f03793c4f
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/admin/resource/DeleteAlertsCmd.java
@@ -0,0 +1,99 @@
+// 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.resource;
+
+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.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.AlertResponse;
+import org.apache.cloudstack.api.response.SuccessResponse;
+import org.apache.log4j.Logger;
+
+import com.cloud.exception.InvalidParameterValueException;
+import com.cloud.user.Account;
+
+@APICommand(name = "deleteAlerts", description = "Delete one or more alerts.", responseObject = SuccessResponse.class)
+public class DeleteAlertsCmd extends BaseCmd {
+
+ public static final Logger s_logger = Logger.getLogger(DeleteAlertsCmd.class.getName());
+
+ private static final String s_name = "deletealertsresponse";
+
+ // ///////////////////////////////////////////////////
+ // ////////////// API parameters /////////////////////
+ // ///////////////////////////////////////////////////
+
+ @Parameter(name = ApiConstants.IDS, type = CommandType.LIST, collectionType = CommandType.UUID, entityType = AlertResponse.class,
+ description = "the IDs of the alerts")
+ private List ids;
+
+ @Parameter(name=ApiConstants.OLDER_THAN, type=CommandType.DATE, description="delete alerts older than (including) this date (use format \"yyyy-MM-dd\")")
+ private Date olderThan;
+
+ @Parameter(name = ApiConstants.TYPE, type = CommandType.STRING, description = "delete by alert type")
+ private String type;
+
+ // ///////////////////////////////////////////////////
+ // ///////////////// Accessors ///////////////////////
+ // ///////////////////////////////////////////////////
+
+ public List getIds() {
+ return ids;
+ }
+
+ public Date getOlderThan() {
+ return olderThan;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ // ///////////////////////////////////////////////////
+ // ///////////// API Implementation///////////////////
+ // ///////////////////////////////////////////////////
+
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
+
+ @Override
+ public long getEntityOwnerId() {
+ return Account.ACCOUNT_ID_SYSTEM;
+ }
+
+ @Override
+ public void execute() {
+ if(ids == null && type == null && olderThan == null) {
+ throw new InvalidParameterValueException("either ids, type or olderthan must be specified");
+ }
+ boolean result = _mgr.deleteAlerts(this);
+ if (result) {
+ SuccessResponse response = new SuccessResponse(getCommandName());
+ this.setResponseObject(response);
+ } else {
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Unable to delete Alerts, one or more parameters has invalid values");
+ }
+ }
+}
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 db7a20b02..015d82bcc 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.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 ce20a3e27..b0badb8bb 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.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 97ec1dcee..9704c640f 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.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.CustomCertificateResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.event.EventTypes;
import com.cloud.user.Account;
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 766e19cbe..f19e0fae7 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,24 +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.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.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;
@@ -42,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 /////////////////////
@@ -115,7 +117,7 @@ public Long getInstanceId() {
@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());
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 54a840987..39fac1362 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,7 +84,7 @@ public long getEntityOwnerId() {
@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());
@@ -88,7 +96,7 @@ public void execute(){
@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());
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 1645456bf..3efc865e4 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,16 +16,15 @@
// 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.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.DomainRouterResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.async.AsyncJob;
import com.cloud.event.EventTypes;
import com.cloud.exception.ConcurrentOperationException;
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 198d8766b..d2b26c0ac 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 0a93ea5ab..9420473a5 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 @@
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 String getCommandName() {
@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 a095fce9c..c9b518f63 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.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.DomainRouterResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.async.AsyncJob;
import com.cloud.event.EventTypes;
import com.cloud.exception.ConcurrentOperationException;
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 595afc76d..1d3930b6b 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.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.DomainRouterResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.async.AsyncJob;
import com.cloud.event.EventTypes;
import com.cloud.exception.ConcurrentOperationException;
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 571b2c199..60dd9386c 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,16 +16,15 @@
// 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.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.DomainRouterResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.async.AsyncJob;
import com.cloud.event.EventTypes;
import com.cloud.exception.ConcurrentOperationException;
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 f8742a2ce..b049f66f6 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.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.DomainRouterResponse;
+import org.apache.cloudstack.api.response.ServiceOfferingResponse;
+import org.apache.log4j.Logger;
+
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;
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 ec62858f5..dbd9bff63 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,25 +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.APICommand;
import org.apache.cloudstack.api.ApiErrorCode;
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.S3Response;
+
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.DiscoveryException;
import com.cloud.exception.InsufficientCapacityException;
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 59a2164e4..b50cb277b 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,16 +16,15 @@
// under the License.
package org.apache.cloudstack.api.command.admin.storage;
-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.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.StoragePoolResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.async.AsyncJob;
import com.cloud.event.EventTypes;
import com.cloud.exception.ResourceUnavailableException;
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 b5068115e..5178d6858 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 @@
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 {
@@ -44,7 +49,7 @@ public class CreateStoragePoolCmd extends BaseCmd {
/////////////////////////////////////////////////////
@Parameter(name=ApiConstants.CLUSTER_ID, type=CommandType.UUID, entityType = ClusterResponse.class,
- required=true, description="the cluster ID for the storage pool")
+ description="the cluster ID for the storage pool")
private Long clusterId;
@Parameter(name=ApiConstants.DETAILS, type=CommandType.MAP, description="the details for the storage pool")
@@ -54,7 +59,7 @@ public class CreateStoragePoolCmd extends BaseCmd {
private String storagePoolName;
@Parameter(name=ApiConstants.POD_ID, type=CommandType.UUID, entityType = PodResponse.class,
- required=true, description="the Pod ID for the storage pool")
+ description="the Pod ID for the storage pool")
private Long podId;
@Parameter(name=ApiConstants.TAGS, type=CommandType.STRING, description="the tags for the storage pool")
@@ -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 name")
+ private String storageProviderName;
+
+ @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 String getUrl() {
public Long getZoneId() {
return zoneId;
}
+
+ public String getStorageProviderName() {
+ return this.storageProviderName;
+ }
+
+ public String getScope() {
+ return this.scope;
+ }
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
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 8cf4a4b79..6aaf53ea5 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;
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 d0f6d7221..4ab71de24 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.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.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 9c5c584b7..02b98037b 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.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/ListStorageProvidersCmd.java b/api/src/org/apache/cloudstack/api/command/admin/storage/ListStorageProvidersCmd.java
new file mode 100644
index 000000000..0dfc6633c
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/admin/storage/ListStorageProvidersCmd.java
@@ -0,0 +1,72 @@
+/*
+ * 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.storage;
+
+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.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.StorageProviderResponse;
+import org.apache.log4j.Logger;
+
+import com.cloud.exception.ConcurrentOperationException;
+import com.cloud.exception.InsufficientCapacityException;
+import com.cloud.exception.NetworkRuleConflictException;
+import com.cloud.exception.ResourceAllocationException;
+import com.cloud.exception.ResourceUnavailableException;
+
+@APICommand(name = "listStorageProviders", description="Lists storage providers.", responseObject=StorageProviderResponse.class)
+public class ListStorageProvidersCmd extends BaseListCmd {
+ public static final Logger s_logger = Logger.getLogger(ListStorageProvidersCmd.class.getName());
+ private static final String s_name = "liststorageprovidersresponse";
+
+ @Parameter(name=ApiConstants.TYPE, type=CommandType.STRING, description="the type of storage provider: either primary or image", required = true)
+ private String type;
+
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
+
+ public String getType() {
+ return this.type;
+ }
+
+ @Override
+ public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException,
+ NetworkRuleConflictException {
+ if (getType() == null) {
+ throw new ServerApiException(ApiErrorCode.MALFORMED_PARAMETER_ERROR, "need to specify type: either primary or image");
+ }
+
+ List providers = this.dataStoreProviderApiService.getDataStoreProviders(getType());
+ ListResponse responses = new ListResponse();
+ for (StorageProviderResponse provider : providers) {
+ provider.setObjectName("dataStoreProvider");
+ }
+ responses.setResponses(providers);
+ responses.setResponseName(this.getCommandName());
+ this.setResponseObject(responses);
+ }
+}
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 ab9c22690..95a92149d 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,16 +16,15 @@
// under the License.
package org.apache.cloudstack.api.command.admin.storage;
-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.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.StoragePoolResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.async.AsyncJob;
import com.cloud.event.EventTypes;
import com.cloud.exception.InsufficientCapacityException;
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 b60ed7f97..2ecb90f69 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 @@
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.StoragePoolResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.storage.StoragePool;
import com.cloud.user.Account;
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 61f903e9c..364d916ad 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;
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 af2664379..7cfe6e1ab 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,14 +20,14 @@
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;
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 dc53ea751..ef7af5c0a 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.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.SystemVmResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.async.AsyncJob;
import com.cloud.event.EventTypes;
import com.cloud.user.Account;
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 27e2ee40d..f230a20d5 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.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.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 909fe20f8..31871b92b 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,18 +16,17 @@
// under the License.
package org.apache.cloudstack.api.command.admin.systemvm;
-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.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.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;
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 2e7b53033..6e4c925ff 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,16 +16,15 @@
// under the License.
package org.apache.cloudstack.api.command.admin.systemvm;
-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.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.SystemVmResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.async.AsyncJob;
import com.cloud.event.EventTypes;
import com.cloud.user.Account;
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 40f9d62aa..f97d89992 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,16 +16,15 @@
// under the License.
package org.apache.cloudstack.api.command.admin.systemvm;
-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.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.SystemVmResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.async.AsyncJob;
import com.cloud.event.EventTypes;
import com.cloud.user.Account;
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 134043cb3..5f9a3efbd 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.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.SystemVmResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.async.AsyncJob;
import com.cloud.event.EventTypes;
import com.cloud.exception.ConcurrentOperationException;
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 14046f39a..e91d0053c 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;
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 74f339155..7d41d10ae 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 @@
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 000000000..48424fef2
--- /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 a73362453..7211bae8d 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,17 +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.APICommand;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.ApiErrorCode;
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.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;
diff --git a/api/src/org/apache/cloudstack/api/command/admin/usage/DeleteTrafficMonitorCmd.java b/api/src/org/apache/cloudstack/api/command/admin/usage/DeleteTrafficMonitorCmd.java
new file mode 100644
index 000000000..e3bb299dc
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/admin/usage/DeleteTrafficMonitorCmd.java
@@ -0,0 +1,84 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package 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.HostResponse;
+import org.apache.cloudstack.api.response.SuccessResponse;
+import org.apache.log4j.Logger;
+
+import com.cloud.exception.InvalidParameterValueException;
+import com.cloud.user.Account;
+
+@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";
+
+ /////////////////////////////////////////////////////
+ //////////////// 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
+ public long getEntityOwnerId() {
+ return Account.ACCOUNT_ID_SYSTEM;
+ }
+
+ @Override
+ public void execute(){
+ 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 526921830..32e0512a2 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,17 +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.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.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;
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 94%
rename from server/src/com/cloud/api/commands/GenerateUsageRecordsCmd.java
rename to api/src/org/apache/cloudstack/api/command/admin/usage/GenerateUsageRecordsCmd.java
index 4206cf828..13710f974 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.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,8 +78,7 @@ public long getEntityOwnerId() {
@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);
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 000000000..f4960dd0e
--- /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 21ad33913..e8e3b22c1 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 org.apache.cloudstack.api.command.user.offering.ListServiceOfferingsCmd;
-import org.apache.cloudstack.api.response.ZoneResponse;
-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.command.user.offering.ListServiceOfferingsCmd;
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;
+import org.apache.cloudstack.api.response.ZoneResponse;
+import org.apache.log4j.Logger;
+
+import com.cloud.host.Host;
+
@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 String getCommandName() {
@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 3cd00c02a..14b69c394 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 @@
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 2cbb13df0..f239996a7 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.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 dfa5dc1bb..bc0291173 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.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 long getEntityOwnerId() {
@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 fca070281..d3cf3f843 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,16 +16,15 @@
// under the License.
package org.apache.cloudstack.api.command.admin.usage;
-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.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.TrafficTypeResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.async.AsyncJob;
import com.cloud.event.EventTypes;
import com.cloud.network.PhysicalNetworkTrafficType;
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 1f1e3abc1..7b3f230d1 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,16 +16,16 @@
// 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.ApiErrorCode;
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.UserResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.user.Account;
import com.cloud.user.User;
import com.cloud.user.UserContext;
@@ -56,7 +56,7 @@ public class CreateUserCmd extends BaseCmd {
@Parameter(name=ApiConstants.LASTNAME, type=CommandType.STRING, required=true, description="lastname")
private String lastname;
- @Parameter(name=ApiConstants.PASSWORD, type=CommandType.STRING, required=true, description="Hashed password (Default is MD5). If you wish to use any other hashing algorithm, you would need to write a custom authentication adapter See Docs section.")
+ @Parameter(name=ApiConstants.PASSWORD, type=CommandType.STRING, required=true, description="Clear text password (Default hashed to SHA256SALT). If you wish to use any other hashing algorithm, you would need to write a custom authentication adapter See Docs section.")
private String password;
@Parameter(name=ApiConstants.TIMEZONE, type=CommandType.STRING, description="Specifies a timezone for this command. For more information on the timezone parameter, see Time Zone Format.")
@@ -65,6 +65,9 @@ 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 external provisioning system")
+ private String userUUID;
+
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
@@ -101,6 +104,10 @@ public String getUserName() {
return username;
}
+ public String getUserUUID() {
+ return userUUID;
+ }
+
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
@@ -132,7 +139,7 @@ public long getEntityOwnerId() {
@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());
if (user != null) {
UserResponse response = _responseGenerator.createUserResponse(user);
response.setResponseName(getCommandName());
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 74a073c72..5683d58ab 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,21 +16,24 @@
// 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.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 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;
-@APICommand(name = "deleteUser", description="Creates a user for an account", responseObject=UserResponse.class)
+@APICommand(name = "deleteUser", description="Deletes a user for an account", responseObject=SuccessResponse.class)
public class DeleteUserCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(DeleteUserCmd.class.getName());
@@ -39,9 +42,11 @@ public class DeleteUserCmd extends BaseCmd {
/////////////////////////////////////////////////////
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
- @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType=UserResponse.class, required=true, description="Deletes a user")
+ @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType=UserResponse.class, required=true, description="id of the user to be deleted")
private Long id;
+ @Inject RegionService _regionService;
+
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
@@ -72,7 +77,7 @@ public long getEntityOwnerId() {
@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);
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 6b59de567..6eaa46bed 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,16 +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;
@@ -46,6 +49,8 @@ public class DisableUserCmd extends BaseAsyncCmd {
required=true, description="Disables user by user ID.")
private Long id;
+ @Inject RegionService _regionService;
+
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
@@ -87,7 +92,8 @@ public String getEventDescription() {
@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());
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 bcd0f43e0..382f67c98 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,6 +46,7 @@ public class EnableUserCmd extends BaseCmd {
required=true, description="Enables user by user ID.")
private Long id;
+ @Inject RegionService _regionService;
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
@@ -70,7 +78,8 @@ public long getEntityOwnerId() {
@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());
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 2ffe4ab24..c7b7e09ee 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 3d68e2f48..c5c466c1f 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 1b00bfd29..dbe330317 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,15 +16,15 @@
// 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.ApiErrorCode;
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.log4j.Logger;
+
import com.cloud.user.Account;
import com.cloud.user.User;
import com.cloud.user.UserAccount;
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 06ffc5379..c92e65db6 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 00bfccc10..5ea2dbdef 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;
@@ -52,7 +59,7 @@ public class UpdateUserCmd extends BaseCmd {
@Parameter(name=ApiConstants.LASTNAME, type=CommandType.STRING, description="last name")
private String lastname;
- @Parameter(name=ApiConstants.PASSWORD, type=CommandType.STRING, description="Hashed password (default is MD5). If you wish to use any other hasing algorithm, you would need to write a custom authentication adapter")
+ @Parameter(name=ApiConstants.PASSWORD, type=CommandType.STRING, description="Clear text password (default hashed to SHA256SALT). If you wish to use any other hasing algorithm, you would need to write a custom authentication adapter")
private String password;
@Parameter(name=ApiConstants.SECRET_KEY, type=CommandType.STRING, description="The secret key for the user. Must be specified with userApiKey")
@@ -64,6 +71,8 @@ public class UpdateUserCmd extends BaseCmd {
@Parameter(name=ApiConstants.USERNAME, type=CommandType.STRING, description="Unique username")
private String username;
+ @Inject RegionService _regionService;
+
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
@@ -126,7 +135,8 @@ public long getEntityOwnerId() {
@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());
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 9ac1e253b..541da1ece 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.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.NetworkResponse;
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 Long getZoneId() {
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 Long getPhysicalNetworkId() {
return physicalNetworkId;
}
-
@Override
public String getCommandName() {
return s_name;
diff --git a/api/src/org/apache/cloudstack/api/command/admin/vlan/DedicatePublicIpRangeCmd.java b/api/src/org/apache/cloudstack/api/command/admin/vlan/DedicatePublicIpRangeCmd.java
new file mode 100755
index 000000000..e7b1105af
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/admin/vlan/DedicatePublicIpRangeCmd.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.vlan;
+
+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.VlanIpRangeResponse;
+import org.apache.cloudstack.api.response.ZoneResponse;
+import org.apache.log4j.Logger;
+
+import com.cloud.dc.Vlan;
+import com.cloud.exception.ResourceAllocationException;
+import com.cloud.exception.ResourceUnavailableException;
+import com.cloud.user.Account;
+
+@APICommand(name = "dedicatePublicIpRange", description="Dedicates a Public IP range to an account", responseObject=VlanIpRangeResponse.class)
+public class DedicatePublicIpRangeCmd extends BaseCmd {
+ public static final Logger s_logger = Logger.getLogger(DedicatePublicIpRangeCmd.class.getName());
+
+ private static final String s_name = "dedicatepubliciprangeresponse";
+
+ /////////////////////////////////////////////////////
+ //////////////// API parameters /////////////////////
+ /////////////////////////////////////////////////////
+
+ @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType = VlanIpRangeResponse.class,
+ required=true, description="the id of the VLAN IP range")
+ private Long id;
+
+ @Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, required=true,
+ description="account who will own the VLAN")
+ private String accountName;
+
+ @Parameter(name=ApiConstants.PROJECT_ID, type=CommandType.UUID, entityType = ProjectResponse.class,
+ description="project who will own the VLAN")
+ private Long projectId;
+
+ @Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.UUID, entityType = DomainResponse.class,
+ required=true, description="domain ID of the account owning a VLAN")
+ private Long domainId;
+
+ /////////////////////////////////////////////////////
+ /////////////////// Accessors ///////////////////////
+ /////////////////////////////////////////////////////
+
+ 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 getCommandName() {
+ return s_name;
+ }
+
+ @Override
+ public long getEntityOwnerId() {
+ return Account.ACCOUNT_ID_SYSTEM;
+ }
+
+ @Override
+ public void execute() throws ResourceUnavailableException, ResourceAllocationException {
+ Vlan result = _configService.dedicatePublicIpRange(this);
+ if (result != null) {
+ VlanIpRangeResponse response = _responseGenerator.createVlanIpRangeResponse(result);
+ response.setResponseName(getCommandName());
+ this.setResponseObject(response);
+ } else {
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to dedicate vlan ip range");
+ }
+ }
+
+}
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 d45082a2a..6023b3d6d 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,16 +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.APICommand;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.ApiErrorCode;
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 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)
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 9b6b997c4..db6006a6f 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.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/vlan/ReleasePublicIpRangeCmd.java b/api/src/org/apache/cloudstack/api/command/admin/vlan/ReleasePublicIpRangeCmd.java
new file mode 100644
index 000000000..91cc7d33d
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/admin/vlan/ReleasePublicIpRangeCmd.java
@@ -0,0 +1,77 @@
+// 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.vlan;
+
+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 = "releasePublicIpRange", description="Releases a Public IP range back to the system pool", responseObject=SuccessResponse.class)
+public class ReleasePublicIpRangeCmd extends BaseCmd {
+ public static final Logger s_logger = Logger.getLogger(ReleasePublicIpRangeCmd.class.getName());
+
+ private static final String s_name = "releasepubliciprangeresponse";
+
+ /////////////////////////////////////////////////////
+ //////////////// API parameters /////////////////////
+ /////////////////////////////////////////////////////
+
+ @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType = VlanIpRangeResponse.class,
+ required=true, description="the id of the Public IP range")
+ 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
+ public void execute(){
+ boolean result = _configService.releasePublicIpRange(this);
+ if (result) {
+ SuccessResponse response = new SuccessResponse(getCommandName());
+ this.setResponseObject(response);
+ } else {
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to release public ip range");
+ }
+ }
+}
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 525e8d72f..152dd4e14 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,20 +19,23 @@
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;
-@APICommand(name = "assignVirtualMachine", description="Move a user VM to another user under same domain.", responseObject=UserVmResponse.class, since="3.0.0")
+@APICommand(name = "assignVirtualMachine", description="Assign a VM from one account to another under the same domain. This API is available for Basic zones with security groups and Advance zones with guest networks. The VM is restricted to move between accounts under same domain.", responseObject=UserVmResponse.class, since="3.0.0")
public class AssignVMCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(AssignVMCmd.class.getName());
@@ -43,7 +46,7 @@ public class AssignVMCmd extends BaseCmd {
/////////////////////////////////////////////////////
@Parameter(name=ApiConstants.VIRTUAL_MACHINE_ID, type=CommandType.UUID, entityType=UserVmResponse.class,
- required=true, description="the vm ID of the user VM to be moved")
+ required=true, description="id of the VM to be moved")
private Long virtualMachineId;
@Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, required=true, description="account name of the new VM owner.")
@@ -55,11 +58,11 @@ public class AssignVMCmd extends BaseCmd {
//Network information
@Parameter(name=ApiConstants.NETWORK_IDS, type=CommandType.LIST, collectionType=CommandType.UUID, entityType=NetworkResponse.class,
- description="list of network ids that will be part of VM network after move in advanced network setting.")
+ description="list of new network ids in which the moved VM will participate. In case no network ids are provided the VM will be part of the default network for that zone. In case there is no network yet created for the new account the default network will be created.")
private List networkIds;
@Parameter(name=ApiConstants.SECURITY_GROUP_IDS, type=CommandType.LIST, collectionType=CommandType.UUID, entityType=SecurityGroupResponse.class,
- description="comma separated list of security groups id that going to be applied to the virtual machine. Should be passed only when vm is moved in a zone with Basic Network support.")
+ description="list of security group ids to be applied on the virtual machine. In case no security groups are provided the VM is part of the default security group.")
private List securityGroupIdList;
/////////////////////////////////////////////////////
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 e1f20a8e9..ddba78ea0 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;
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 be4d10b8b..13e755c57 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,15 +16,15 @@
// under the License.
package org.apache.cloudstack.api.command.admin.vm;
-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.APICommand;
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;
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 392b6276b..9fd736f85 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,19 +16,18 @@
// under the License.
package org.apache.cloudstack.api.command.admin.vpc;
-import org.apache.cloudstack.api.response.PhysicalNetworkResponse;
-import org.apache.cloudstack.api.response.VpcResponse;
-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.PhysicalNetworkResponse;
import org.apache.cloudstack.api.response.PrivateGatewayResponse;
+import org.apache.cloudstack.api.response.VpcResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.async.AsyncJob;
import com.cloud.event.EventTypes;
import com.cloud.exception.ConcurrentOperationException;
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 8ccb9d5e6..4a3a92a21 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,10 +72,33 @@ public List getSupportedServices() {
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 = _vpcProvSvc.createVpcOffering(getVpcOfferingName(), getDisplayText(), getSupportedServices(), getServiceProviders());
if (vpcOff != null) {
this.setEntityId(vpcOff.getId());
this.setEntityUuid(vpcOff.getUuid());
@@ -78,7 +109,7 @@ public void create() throws ResourceAllocationException {
@Override
public void execute() {
- VpcOffering vpc = _vpcService.getVpcOffering(this.getEntityId());
+ VpcOffering vpc = _vpcProvSvc.getVpcOffering(this.getEntityId());
if (vpc != null) {
VpcOfferingResponse response = _responseGenerator.createVpcOfferingResponse(vpc);
response.setResponseName(getCommandName());
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 2b0e1a6a1..182a19e06 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,17 +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.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.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;
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 9a257c24c..4b16fa5fc 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,17 +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.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.SuccessResponse;
+import org.apache.cloudstack.api.response.VpcOfferingResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.event.EventTypes;
import com.cloud.user.Account;
@@ -67,7 +66,7 @@ public long getEntityOwnerId() {
@Override
public void execute(){
- boolean result = _vpcService.deleteVpcOffering(getId());
+ boolean result = _vpcProvSvc.deleteVpcOffering(getId());
if (result) {
SuccessResponse response = new SuccessResponse(getCommandName());
this.setResponseObject(response);
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 c8fa77df1..9bbae0643 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.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.VpcOfferingResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.event.EventTypes;
import com.cloud.network.vpc.VpcOffering;
import com.cloud.user.Account;
@@ -84,7 +88,7 @@ public long getEntityOwnerId() {
@Override
public void execute(){
- VpcOffering result = _vpcService.updateVpcOffering(getId(), getVpcOfferingName(), getDisplayText(), getState());
+ VpcOffering result = _vpcProvSvc.updateVpcOffering(getId(), getVpcOfferingName(), getDisplayText(), getState());
if (result != null) {
VpcOfferingResponse response = _responseGenerator.createVpcOfferingResponse(result);
response.setResponseName(getCommandName());
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 ae57fae5a..5cc905227 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,17 +16,16 @@
// under the License.
package org.apache.cloudstack.api.command.admin.zone;
-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.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.ZoneResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.dc.DataCenter;
import com.cloud.user.Account;
import com.cloud.user.UserContext;
@@ -47,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;
@@ -90,6 +95,14 @@ public String getDns2() {
return dns2;
}
+ public String getIp6Dns1() {
+ return ip6Dns1;
+ }
+
+ public String getIp6Dns2() {
+ return ip6Dns2;
+ }
+
public String getGuestCidrAddress() {
return guestCidrAddress;
}
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 e9a02accb..e3d14f729 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;
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 59a37c96a..858457bf4 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,22 +17,20 @@
package org.apache.cloudstack.api.command.admin.zone;
-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.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.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 {
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 143c8f7a8..16c334eeb 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 @@
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.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 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 Long getId() {
return id;
}
+ public String getIp6Dns1() {
+ return ip6Dns1;
+ }
+
+ public String getIp6Dns2() {
+ return ip6Dns2;
+ }
+
public String getInternalDns1() {
return internalDns1;
}
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 f62be0bf8..ebc227235 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;
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 ef14d1ae7..df6deae18 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;
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 f679a5ae7..ebf2e4ba0 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 2c279db64..c91e2f2b5 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 4437191db..28fbae443 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
@@ -16,39 +16,21 @@
// under the License.
package org.apache.cloudstack.api.command.user.address;
-import java.util.List;
-
-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.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.VpcResponse;
-import org.apache.cloudstack.api.response.ZoneResponse;
import com.cloud.async.AsyncJob;
import com.cloud.dc.DataCenter;
import com.cloud.dc.DataCenter.NetworkType;
import com.cloud.event.EventTypes;
-import com.cloud.exception.ConcurrentOperationException;
-import com.cloud.exception.InsufficientAddressCapacityException;
-import com.cloud.exception.InsufficientCapacityException;
-import com.cloud.exception.InvalidParameterValueException;
-import com.cloud.exception.ResourceAllocationException;
-import com.cloud.exception.ResourceUnavailableException;
+import com.cloud.exception.*;
import com.cloud.network.IpAddress;
import com.cloud.network.Network;
import com.cloud.network.vpc.Vpc;
import com.cloud.user.Account;
import com.cloud.user.UserContext;
+import org.apache.cloudstack.api.*;
+import org.apache.cloudstack.api.response.*;
+import org.apache.log4j.Logger;
+
+import java.util.List;
@APICommand(name = "associateIpAddress", description="Acquires and associates a public IP to an account.", responseObject=IPAddressResponse.class)
public class AssociateIPAddrCmd extends BaseAsyncCreateCmd {
@@ -214,7 +196,7 @@ public static String getResultObjectName() {
@Override
public void create() throws ResourceAllocationException{
try {
- IpAddress ip = _networkService.allocateIP(_accountService.getAccount(getEntityOwnerId()), false, getZoneId());
+ IpAddress ip = _networkService.allocateIP(_accountService.getAccount(getEntityOwnerId()), getZoneId(), getNetworkId());
if (ip != null) {
this.setEntityId(ip.getId());
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 c208a1a3d..827111902 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;
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 06b08da69..ac0f823c1 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 @@
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/affinitygroup/CreateAffinityGroupCmd.java b/api/src/org/apache/cloudstack/api/command/user/affinitygroup/CreateAffinityGroupCmd.java
new file mode 100644
index 000000000..96de4aa13
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/user/affinitygroup/CreateAffinityGroupCmd.java
@@ -0,0 +1,167 @@
+// 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.affinitygroup;
+
+import org.apache.cloudstack.affinity.AffinityGroup;
+import org.apache.cloudstack.affinity.AffinityGroupResponse;
+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.log4j.Logger;
+
+import com.cloud.async.AsyncJob;
+import com.cloud.event.EventTypes;
+import com.cloud.exception.ResourceAllocationException;
+import com.cloud.user.Account;
+import com.cloud.user.UserContext;
+
+@APICommand(name = "createAffinityGroup", responseObject = AffinityGroupResponse.class, description = "Creates an affinity/anti-affinity group")
+public class CreateAffinityGroupCmd extends BaseAsyncCreateCmd {
+ public static final Logger s_logger = Logger.getLogger(CreateAffinityGroupCmd.class.getName());
+
+ private static final String s_name = "createaffinitygroupresponse";
+
+ // ///////////////////////////////////////////////////
+ // ////////////// API parameters /////////////////////
+ // ///////////////////////////////////////////////////
+
+ @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "an account for the affinity group. Must be used with domainId.")
+ private String accountName;
+
+ @Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, description = "domainId of the account owning the affinity group", entityType = DomainResponse.class)
+ private Long domainId;
+
+ @Parameter(name = ApiConstants.DESCRIPTION, type = CommandType.STRING, description = "optional description of the affinity group")
+ private String description;
+
+ @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, required = true, description = "name of the affinity group")
+ private String affinityGroupName;
+
+ @Parameter(name = ApiConstants.TYPE, type = CommandType.STRING, required = true, description = "Type of the affinity group from the available affinity/anti-affinity group types")
+ private String affinityGroupType;
+
+
+ // ///////////////////////////////////////////////////
+ // ///////////////// Accessors ///////////////////////
+ // ///////////////////////////////////////////////////
+
+ public String getAccountName() {
+ return accountName;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public Long getDomainId() {
+ return domainId;
+ }
+
+ public String getAffinityGroupName() {
+ return affinityGroupName;
+ }
+
+ public String getAffinityGroupType() {
+ return affinityGroupType;
+ }
+
+ // ///////////////////////////////////////////////////
+ // ///////////// API Implementation///////////////////
+ // ///////////////////////////////////////////////////
+
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
+
+ @Override
+ public long getEntityOwnerId() {
+ Account account = UserContext.current().getCaller();
+ if ((account == null) || isAdmin(account.getType())) {
+ if ((domainId != null) && (accountName != null)) {
+ Account userAccount = _responseGenerator.findAccountByNameDomain(accountName, domainId);
+ if (userAccount != null) {
+ return userAccount.getId();
+ }
+ }
+ }
+
+ 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 void execute() {
+ AffinityGroup group = _affinityGroupService.getAffinityGroup(getEntityId());
+ if (group != null) {
+ AffinityGroupResponse response = _responseGenerator.createAffinityGroupResponse(group);
+ response.setResponseName(getCommandName());
+ this.setResponseObject(response);
+ } else {
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create affinity group:"
+ + affinityGroupName);
+ }
+ }
+
+ @Override
+ public void create() throws ResourceAllocationException {
+ AffinityGroup result = _affinityGroupService.createAffinityGroup(accountName, domainId, affinityGroupName,
+ affinityGroupType, description);
+ if (result != null) {
+ setEntityId(result.getId());
+ setEntityUuid(result.getUuid());
+ } else {
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create affinity group entity" + affinityGroupName);
+ }
+
+ }
+
+ @Override
+ public String getEventType() {
+ return EventTypes.EVENT_AFFINITY_GROUP_CREATE;
+ }
+
+ @Override
+ public String getEventDescription() {
+ return "creating Affinity Group";
+ }
+
+ @Override
+ public String getCreateEventType() {
+ return EventTypes.EVENT_AFFINITY_GROUP_CREATE;
+ }
+
+ @Override
+ public String getCreateEventDescription() {
+ return "creating Affinity Group";
+ }
+
+ @Override
+ public AsyncJob.Type getInstanceType() {
+ return AsyncJob.Type.AffinityGroup;
+ }
+
+}
diff --git a/api/src/org/apache/cloudstack/api/command/user/affinitygroup/DeleteAffinityGroupCmd.java b/api/src/org/apache/cloudstack/api/command/user/affinitygroup/DeleteAffinityGroupCmd.java
new file mode 100644
index 000000000..ea4a010ab
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/user/affinitygroup/DeleteAffinityGroupCmd.java
@@ -0,0 +1,154 @@
+// 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.affinitygroup;
+
+import org.apache.cloudstack.affinity.AffinityGroupResponse;
+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.log4j.Logger;
+
+import com.cloud.async.AsyncJob;
+import com.cloud.event.EventTypes;
+import com.cloud.exception.InvalidParameterValueException;
+import com.cloud.exception.ResourceInUseException;
+import com.cloud.user.Account;
+import com.cloud.user.UserContext;
+
+@APICommand(name = "deleteAffinityGroup", description = "Deletes affinity group", responseObject = SuccessResponse.class)
+public class DeleteAffinityGroupCmd extends BaseAsyncCmd {
+ public static final Logger s_logger = Logger.getLogger(DeleteAffinityGroupCmd.class.getName());
+ private static final String s_name = "deleteaffinitygroupresponse";
+
+ /////////////////////////////////////////////////////
+ //////////////// API parameters /////////////////////
+ /////////////////////////////////////////////////////
+
+ @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "the account of the affinity group. Must be specified with domain ID")
+ private String accountName;
+
+ @Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, description = "the domain ID of account owning the affinity group", entityType = DomainResponse.class)
+ private Long domainId;
+
+ @Parameter(name = ApiConstants.ID, type = CommandType.UUID, description = "The ID of the affinity group. Mutually exclusive with name parameter", entityType = AffinityGroupResponse.class)
+ private Long id;
+
+ @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "The name of the affinity group. Mutually exclusive with id parameter")
+ private String name;
+
+
+ /////////////////////////////////////////////////////
+ /////////////////// Accessors ///////////////////////
+ /////////////////////////////////////////////////////
+
+ public String getAccountName() {
+ return accountName;
+ }
+
+ public Long getDomainId() {
+ return domainId;
+ }
+
+
+ public Long getId() {
+ if (id != null && name != null) {
+ throw new InvalidParameterValueException("name and id parameters are mutually exclusive");
+ }
+
+ if (name != null) {
+ id = _responseGenerator.getAffinityGroupId(name, getEntityOwnerId());
+ if (id == null) {
+ throw new InvalidParameterValueException("Unable to find affinity group by name " + name
+ + " for the account id=" + getEntityOwnerId());
+ }
+ }
+
+ if (id == null) {
+ throw new InvalidParameterValueException(
+ "Either id or name parameter is requred by deleteAffinityGroup command");
+ }
+
+ return id;
+ }
+
+ /////////////////////////////////////////////////////
+ /////////////// API Implementation///////////////////
+ /////////////////////////////////////////////////////
+
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
+
+ @Override
+ public long getEntityOwnerId() {
+ Account account = UserContext.current().getCaller();
+ if ((account == null) || isAdmin(account.getType())) {
+ if ((domainId != null) && (accountName != null)) {
+ Account userAccount = _responseGenerator.findAccountByNameDomain(accountName, domainId);
+ if (userAccount != null) {
+ return userAccount.getId();
+ }
+ }
+ }
+
+ 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 void execute(){
+ try{
+ boolean result = _affinityGroupService.deleteAffinityGroup(id, accountName, domainId, name);
+ if (result) {
+ SuccessResponse response = new SuccessResponse(getCommandName());
+ this.setResponseObject(response);
+ } else {
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete affinity group");
+ }
+ } catch (ResourceInUseException ex) {
+ s_logger.warn("Exception: ", ex);
+ throw new ServerApiException(ApiErrorCode.RESOURCE_IN_USE_ERROR, ex.getMessage());
+ }
+ }
+
+ @Override
+ public String getEventType() {
+ return EventTypes.EVENT_AFFINITY_GROUP_DELETE;
+ }
+
+ @Override
+ public String getEventDescription() {
+ return "Deleting Affinity Group";
+ }
+
+ @Override
+ public AsyncJob.Type getInstanceType() {
+ return AsyncJob.Type.AffinityGroup;
+ }
+}
diff --git a/api/src/org/apache/cloudstack/api/command/user/affinitygroup/ListAffinityGroupTypesCmd.java b/api/src/org/apache/cloudstack/api/command/user/affinitygroup/ListAffinityGroupTypesCmd.java
new file mode 100644
index 000000000..ce6e89a07
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/user/affinitygroup/ListAffinityGroupTypesCmd.java
@@ -0,0 +1,67 @@
+// 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.affinitygroup;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.cloudstack.affinity.AffinityGroupTypeResponse;
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.BaseListCmd;
+import org.apache.cloudstack.api.response.ListResponse;
+import org.apache.log4j.Logger;
+
+import com.cloud.user.Account;
+
+@APICommand(name = "listAffinityGroupTypes", description = "Lists affinity group types available", responseObject = AffinityGroupTypeResponse.class)
+public class ListAffinityGroupTypesCmd extends BaseListCmd {
+ public static final Logger s_logger = Logger.getLogger(ListAffinityGroupTypesCmd.class.getName());
+
+ private static final String s_name = "listaffinitygrouptypesresponse";
+
+
+ /////////////////////////////////////////////////////
+ /////////////// API Implementation///////////////////
+ /////////////////////////////////////////////////////
+
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
+
+ public long getEntityOwnerId() {
+ return Account.ACCOUNT_ID_SYSTEM;
+ }
+
+ @Override
+ public void execute() {
+ List result = _affinityGroupService.listAffinityGroupTypes();
+ ListResponse response = new ListResponse();
+ ArrayList responses = new ArrayList();
+ if (result != null) {
+ for (String type : result) {
+ AffinityGroupTypeResponse affinityTypeResponse = new AffinityGroupTypeResponse();
+ affinityTypeResponse.setType(type);
+ affinityTypeResponse.setObjectName("affinityGroupType");
+ responses.add(affinityTypeResponse);
+ }
+ }
+ response.setResponses(responses);
+ response.setResponseName(getCommandName());
+ this.setResponseObject(response);
+ }
+}
diff --git a/api/src/org/apache/cloudstack/api/command/user/affinitygroup/ListAffinityGroupsCmd.java b/api/src/org/apache/cloudstack/api/command/user/affinitygroup/ListAffinityGroupsCmd.java
new file mode 100644
index 000000000..9310fb910
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/user/affinitygroup/ListAffinityGroupsCmd.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 org.apache.cloudstack.api.command.user.affinitygroup;
+
+import org.apache.cloudstack.affinity.AffinityGroupResponse;
+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.UserVmResponse;
+import org.apache.log4j.Logger;
+
+import com.cloud.async.AsyncJob;
+
+@APICommand(name = "listAffinityGroups", description = "Lists affinity groups", responseObject = AffinityGroupResponse.class)
+public class ListAffinityGroupsCmd extends BaseListCmd {
+ public static final Logger s_logger = Logger.getLogger(ListAffinityGroupsCmd.class.getName());
+
+ private static final String s_name = "listaffinitygroupsresponse";
+
+ /////////////////////////////////////////////////////
+ //////////////// API parameters /////////////////////
+ /////////////////////////////////////////////////////
+
+ @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "lists affinity groups by name")
+ private String affinityGroupName;
+
+ @Parameter(name = ApiConstants.VIRTUAL_MACHINE_ID, type = CommandType.UUID, description = "lists affinity groups by virtual machine id", entityType = UserVmResponse.class)
+ private Long virtualMachineId;
+
+ @Parameter(name = ApiConstants.ID, type = CommandType.UUID, description = "list the affinity group by the id provided", entityType = AffinityGroupResponse.class)
+ private Long id;
+
+ @Parameter(name = ApiConstants.TYPE, type = CommandType.STRING, description = "lists affinity groups by type")
+ private String affinityGroupType;
+
+ /////////////////////////////////////////////////////
+ /////////////////// Accessors ///////////////////////
+ /////////////////////////////////////////////////////
+ public String getAffinityGroupName() {
+ return affinityGroupName;
+ }
+
+ public Long getVirtualMachineId() {
+ return virtualMachineId;
+ }
+
+ public Long getId(){
+ return id;
+ }
+
+ /////////////////////////////////////////////////////
+ /////////////// API Implementation///////////////////
+ /////////////////////////////////////////////////////
+
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
+
+ @Override
+ public void execute(){
+
+ ListResponse response = _queryService.listAffinityGroups(id, affinityGroupName,
+ affinityGroupType, virtualMachineId, this.getStartIndex(), this.getPageSizeVal());
+ response.setResponseName(getCommandName());
+ this.setResponseObject(response);
+
+ }
+
+ @Override
+ public AsyncJob.Type getInstanceType() {
+ return AsyncJob.Type.AffinityGroup;
+ }
+}
diff --git a/api/src/org/apache/cloudstack/api/command/user/affinitygroup/UpdateVMAffinityGroupCmd.java b/api/src/org/apache/cloudstack/api/command/user/affinitygroup/UpdateVMAffinityGroupCmd.java
new file mode 100644
index 000000000..44d017b7d
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/user/affinitygroup/UpdateVMAffinityGroupCmd.java
@@ -0,0 +1,164 @@
+// 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.affinitygroup;
+
+import java.util.ArrayList;
+import java.util.EnumSet;
+import java.util.List;
+
+import org.apache.cloudstack.affinity.AffinityGroupResponse;
+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.ApiConstants.VMDetails;
+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;
+import com.cloud.exception.InvalidParameterValueException;
+import com.cloud.exception.ResourceUnavailableException;
+import com.cloud.user.Account;
+import com.cloud.user.UserContext;
+import com.cloud.uservm.UserVm;
+
+
+@APICommand(name = "updateVMAffinityGroup", description = "Updates the affinity/anti-affinity group associations of a virtual machine. The VM has to be stopped and restarted for the "
+ + "new properties to take effect.", responseObject = UserVmResponse.class)
+public class UpdateVMAffinityGroupCmd extends BaseAsyncCmd {
+ public static final Logger s_logger = Logger.getLogger(UpdateVMAffinityGroupCmd.class.getName());
+ private static final String s_name = "updatevirtualmachineresponse";
+
+ /////////////////////////////////////////////////////
+ //////////////// API parameters /////////////////////
+ /////////////////////////////////////////////////////
+
+
+ @ACL
+ @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType=UserVmResponse.class,
+ required=true, description="The ID of the virtual machine")
+ private Long id;
+
+ @ACL
+ @Parameter(name = ApiConstants.AFFINITY_GROUP_IDS, type = CommandType.LIST, collectionType = CommandType.UUID, entityType = AffinityGroupResponse.class, description = "comma separated list of affinity groups id that are going to be applied to the virtual machine. "
+ + "Should be passed only when vm is created from a zone with Basic Network support."
+ + " Mutually exclusive with securitygroupnames parameter")
+ private List affinityGroupIdList;
+
+ @ACL
+ @Parameter(name = ApiConstants.AFFINITY_GROUP_NAMES, type = CommandType.LIST, collectionType = CommandType.STRING, entityType = AffinityGroupResponse.class, description = "comma separated list of affinity groups names that are going to be applied to the virtual machine."
+ + " Should be passed only when vm is created from a zone with Basic Network support. "
+ + "Mutually exclusive with securitygroupids parameter")
+ private List affinityGroupNameList;
+
+ /////////////////////////////////////////////////////
+ /////////////////// Accessors ///////////////////////
+ /////////////////////////////////////////////////////
+
+
+ public Long getId() {
+ return id;
+ }
+
+
+ public List getAffinityGroupIdList() {
+ if (affinityGroupNameList != null && affinityGroupIdList != null) {
+ throw new InvalidParameterValueException(
+ "affinitygroupids parameter is mutually exclusive with affinitygroupnames parameter");
+ }
+
+ // transform group names to ids here
+ if (affinityGroupNameList != null) {
+ List affinityGroupIds = new ArrayList();
+ for (String groupName : affinityGroupNameList) {
+ Long groupId = _responseGenerator.getAffinityGroupId(groupName, getEntityOwnerId());
+ if (groupId == null) {
+ throw new InvalidParameterValueException("Unable to find group by name " + groupName
+ + " for account " + getEntityOwnerId());
+ } else {
+ affinityGroupIds.add(groupId);
+ }
+ }
+ return affinityGroupIds;
+ } else {
+ return affinityGroupIdList;
+ }
+ }
+
+ /////////////////////////////////////////////////////
+ /////////////// API Implementation///////////////////
+ /////////////////////////////////////////////////////
+
+
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
+
+ public static String getResultObjectName() {
+ return "virtualmachine";
+ }
+
+ @Override
+ public long getEntityOwnerId() {
+ UserVm userVm = _entityMgr.findById(UserVm.class, getId());
+ if (userVm != null) {
+ return userVm.getAccountId();
+ }
+
+ return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent this command to SYSTEM so ERROR events are tracked
+ }
+
+ @Override
+ public void execute() throws ResourceUnavailableException,
+ InsufficientCapacityException, ServerApiException {
+ UserContext.current().setEventDetails("Vm Id: "+getId());
+ UserVm result = _affinityGroupService.updateVMAffinityGroups(getId(), getAffinityGroupIdList());
+ ArrayList dc = new ArrayList();
+ dc.add(VMDetails.valueOf("affgrp"));
+ 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 update vm's affinity groups");
+ }
+ }
+
+ @Override
+ public String getEventType() {
+ return EventTypes.EVENT_VM_AFFINITY_GROUP_UPDATE;
+ }
+
+ @Override
+ public String getEventDescription() {
+ return "updating VM Affinity Group";
+ }
+
+ @Override
+ public AsyncJob.Type getInstanceType() {
+ return AsyncJob.Type.AffinityGroup;
+ }
+
+}
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 987d305b4..f6e4f96dd 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 @@
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;
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 400be5db3..135c87717 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 @@
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;
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 39814e7b9..87d4466e7 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,20 +19,19 @@
import java.util.HashMap;
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.ApiErrorCode;
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.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;
@@ -57,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;
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 89da23451..3eff5d08e 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,18 +17,17 @@
package org.apache.cloudstack.api.command.user.autoscale;
-import org.apache.cloudstack.api.response.CounterResponse;
-import org.apache.cloudstack.api.response.DomainResponse;
-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.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 org.apache.cloudstack.api.response.CounterResponse;
+import org.apache.cloudstack.api.response.DomainResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.async.AsyncJob;
import com.cloud.event.EventTypes;
import com.cloud.exception.ResourceAllocationException;
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 aa236ee08..f8b359566 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,17 +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.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.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;
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 54eb74627..d0107368e 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,17 +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.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.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;
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 726f006ef..c55973c91 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,17 +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.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.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;
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 5ce1ee27a..57e38f9ab 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,17 +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.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.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;
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 f4f921297..5d2fb4bd1 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,16 +17,15 @@
package org.apache.cloudstack.api.command.user.autoscale;
-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.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.AutoScaleVmGroupResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.async.AsyncJob;
import com.cloud.event.EventTypes;
import com.cloud.network.as.AutoScaleVmGroup;
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 80ac818d2..5cb7e5605 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.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.AutoScaleVmGroupResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.async.AsyncJob;
import com.cloud.event.EventTypes;
import com.cloud.network.as.AutoScaleVmGroup;
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 316214422..8426db8c1 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 @@
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 7561757fc..5b3ee42e5 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.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.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 7a88db3e7..8afdf028e 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.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 0b3ffec04..1c9492324 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 @@
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 66a38f343..bd6790d67 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.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 6a55a4aa1..fbe2be840 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,17 +19,16 @@
import java.util.List;
-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.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.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;
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 fc6a7c6b8..5acfb942f 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 @@
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;
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 570ed0beb..34def9dac 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 @@
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;
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 129aeb85d..a30e26cfd 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 @@
import java.util.Map;
-import org.apache.log4j.Logger;
-
-import org.apache.cloudstack.api.BaseCmd;
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 com.cloud.user.Account;
@APICommand(name = "listCapabilities", description="Lists capabilities", responseObject=CapabilitiesResponse.class)
@@ -52,6 +52,12 @@ public void execute(){
response.setProjectInviteRequired((Boolean)capabilities.get("projectInviteRequired"));
response.setAllowUsersCreateProjects((Boolean)capabilities.get("allowusercreateprojects"));
response.setDiskOffMaxSize((Long)capabilities.get("customDiskOffMaxSize"));
+ if (capabilities.containsKey("apiLimitInterval")) {
+ response.setApiLimitInterval((Integer) capabilities.get("apiLimitInterval"));
+ }
+ if (capabilities.containsKey("apiLimitMax")) {
+ 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/ArchiveEventsCmd.java b/api/src/org/apache/cloudstack/api/command/user/event/ArchiveEventsCmd.java
new file mode 100644
index 000000000..481607c9f
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/user/event/ArchiveEventsCmd.java
@@ -0,0 +1,105 @@
+//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.event;
+
+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.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.AlertResponse;
+import org.apache.cloudstack.api.response.EventResponse;
+import org.apache.cloudstack.api.response.SuccessResponse;
+import org.apache.log4j.Logger;
+
+import com.cloud.exception.InvalidParameterValueException;
+import com.cloud.user.Account;
+import com.cloud.user.UserContext;
+
+@APICommand(name = "archiveEvents", description = "Archive one or more events.", responseObject = SuccessResponse.class)
+public class ArchiveEventsCmd extends BaseCmd {
+
+ public static final Logger s_logger = Logger.getLogger(ArchiveEventsCmd.class.getName());
+
+ private static final String s_name = "archiveeventsresponse";
+
+ /////////////////////////////////////////////////////
+ //////////////// API parameters /////////////////////
+ /////////////////////////////////////////////////////
+
+ @Parameter(name = ApiConstants.IDS, type = CommandType.LIST, collectionType = CommandType.UUID, entityType = EventResponse.class,
+ description = "the IDs of the events")
+ private List ids;
+
+ @Parameter(name=ApiConstants.OLDER_THAN, type=CommandType.DATE, description="archive events older than (including) this date (use format \"yyyy-MM-dd\" or the new format \"yyyy-MM-dd HH:mm:ss\")")
+ private Date olderThan;
+
+ @Parameter(name = ApiConstants.TYPE, type = CommandType.STRING, description = "archive by event type")
+ private String type;
+
+ /////////////////////////////////////////////////////
+ /////////////////// Accessors ///////////////////////
+ /////////////////////////////////////////////////////
+
+ public List getIds() {
+ return ids;
+ }
+
+ public Date getOlderThan() {
+ return olderThan;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ /////////////////////////////////////////////////////
+ /////////////// API Implementation///////////////////
+ /////////////////////////////////////////////////////
+
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
+
+ @Override
+ public long getEntityOwnerId() {
+ Account account = UserContext.current().getCaller();
+ if (account != null) {
+ return account.getId();
+ }
+ return Account.ACCOUNT_ID_SYSTEM;
+ }
+
+ @Override
+ public void execute() {
+ if(ids == null && type == null && olderThan == null) {
+ throw new InvalidParameterValueException("either ids, type or olderthan must be specified");
+ }
+ boolean result = _mgr.archiveEvents(this);
+ if (result) {
+ SuccessResponse response = new SuccessResponse(getCommandName());
+ this.setResponseObject(response);
+ } else {
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Unable to archive Events, one or more parameters has invalid values");
+ }
+ }
+}
diff --git a/api/src/org/apache/cloudstack/api/command/user/event/DeleteEventsCmd.java b/api/src/org/apache/cloudstack/api/command/user/event/DeleteEventsCmd.java
new file mode 100644
index 000000000..55ca92a5d
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/user/event/DeleteEventsCmd.java
@@ -0,0 +1,105 @@
+//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.event;
+
+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.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.AlertResponse;
+import org.apache.cloudstack.api.response.EventResponse;
+import org.apache.cloudstack.api.response.SuccessResponse;
+import org.apache.log4j.Logger;
+
+import com.cloud.exception.InvalidParameterValueException;
+import com.cloud.user.Account;
+import com.cloud.user.UserContext;
+
+@APICommand(name = "deleteEvents", description = "Delete one or more events.", responseObject = SuccessResponse.class)
+public class DeleteEventsCmd extends BaseCmd {
+
+ public static final Logger s_logger = Logger.getLogger(DeleteEventsCmd.class.getName());
+
+ private static final String s_name = "deleteeventsresponse";
+
+ // ///////////////////////////////////////////////////
+ // ////////////// API parameters /////////////////////
+ // ///////////////////////////////////////////////////
+
+ @Parameter(name = ApiConstants.IDS, type = CommandType.LIST, collectionType = CommandType.UUID, entityType = EventResponse.class,
+ description = "the IDs of the events")
+ private List ids;
+
+ @Parameter(name=ApiConstants.OLDER_THAN, type=CommandType.DATE, description="delete events older than (including) this date (use format \"yyyy-MM-dd\" or the new format \"yyyy-MM-dd HH:mm:ss\")")
+ private Date olderThan;
+
+ @Parameter(name = ApiConstants.TYPE, type = CommandType.STRING, description = "delete by event type")
+ private String type;
+
+ // ///////////////////////////////////////////////////
+ // ///////////////// Accessors ///////////////////////
+ // ///////////////////////////////////////////////////
+
+ public List getIds() {
+ return ids;
+ }
+
+ public Date getOlderThan() {
+ return olderThan;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ // ///////////////////////////////////////////////////
+ // ///////////// API Implementation///////////////////
+ // ///////////////////////////////////////////////////
+
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
+
+ @Override
+ public long getEntityOwnerId() {
+ Account account = UserContext.current().getCaller();
+ if (account != null) {
+ return account.getId();
+ }
+ return Account.ACCOUNT_ID_SYSTEM;
+ }
+
+ @Override
+ public void execute() {
+ if(ids == null && type == null && olderThan == null) {
+ throw new InvalidParameterValueException("either ids, type or enddate must be specified");
+ }
+ boolean result = _mgr.deleteEvents(this);
+ if (result) {
+ SuccessResponse response = new SuccessResponse(getCommandName());
+ this.setResponseObject(response);
+ } else {
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Unable to delete Events, one or more parameters has invalid values");
+ }
+ }
+}
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 4c432f35e..9cbc204b7 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 @@
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 94205d132..63fa194c8 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/CreateFirewallRuleCmd.java b/api/src/org/apache/cloudstack/api/command/user/firewall/CreateFirewallRuleCmd.java
index f5d7b1b02..b7cb47120 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,18 +19,17 @@
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;
@@ -325,7 +324,7 @@ public AsyncJob.Type getInstanceType() {
@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 53348c9df..40128526c 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 @@
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;
@@ -89,6 +94,9 @@ public class CreatePortForwardingRuleCmd extends BaseAsyncCreateCmd implements P
description="The network of the vm the Port Forwarding rule will be created for. " +
"Required when public Ip address is not associated with any Guest network yet (VPC case)")
private Long networkId;
+ @Parameter(name = ApiConstants.VM_GUEST_IP, type = CommandType.STRING, required = false,
+ description = "VM guest nic Secondary ip address for the port forwarding rule")
+ private String vmSecondaryIp;
// ///////////////////////////////////////////////////
// ///////////////// Accessors ///////////////////////
@@ -99,6 +107,13 @@ public Long getIpAddressId() {
return ipAddressId;
}
+ public Ip getVmSecondaryIp() {
+ if (vmSecondaryIp == null) {
+ return null;
+ }
+ return new Ip(vmSecondaryIp);
+ }
+
@Override
public String getProtocol() {
return protocol.trim();
@@ -295,8 +310,15 @@ public void create() {
throw new InvalidParameterValueException("Parameter cidrList is deprecated; if you need to open firewall rule for the specific cidr, please refer to createFirewallRule command");
}
+ Ip privateIp = getVmSecondaryIp();
+ if (privateIp != null) {
+ if ( !privateIp.isIp4()) {
+ throw new InvalidParameterValueException("Invalid vm ip address");
+ }
+ }
+
try {
- PortForwardingRule result = _rulesService.createPortForwardingRule(this, virtualMachineId, getOpenFirewall());
+ PortForwardingRule result = _rulesService.createPortForwardingRule(this, virtualMachineId, privateIp, getOpenFirewall());
setEntityId(result.getId());
setEntityUuid(result.getUuid());
} catch (NetworkRuleConflictException ex) {
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
index 4646cdbcf..0e1d48640 100644
--- a/api/src/org/apache/cloudstack/api/command/user/firewall/DeleteEgressFirewallRuleCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/firewall/DeleteEgressFirewallRuleCmd.java
@@ -26,6 +26,8 @@
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;
@@ -44,11 +46,11 @@ public class DeleteEgressFirewallRuleCmd extends BaseAsyncCmd {
/////////////////////////////////////////////////////
- @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="the ID of the firewall rule")
+ @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.LONG, expose=false)
+ @Parameter(name=ApiConstants.ACCOUNT_ID, type=CommandType.UUID, entityType = AccountResponse.class, expose=false)
private Long ownerId;
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
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 8b0a5c16e..b90082829 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;
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 e70bb1556..838859585 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;
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
index 6eeb53648..b5eed7547 100644
--- a/api/src/org/apache/cloudstack/api/command/user/firewall/ListEgressFirewallRulesCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/firewall/ListEgressFirewallRulesCmd.java
@@ -28,7 +28,9 @@
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;
@@ -40,10 +42,10 @@ public class ListEgressFirewallRulesCmd extends ListFirewallRulesCmd {
/////////////////////////////////////////////////////
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
- @Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="Lists rule with the specified ID.")
+ @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.LONG, description="the id network network for the egress firwall services")
+ @Parameter(name=ApiConstants.NETWORK_ID, type=CommandType.UUID, entityType = NetworkResponse.class, description="the id network network for the egress firwall services")
private Long networkId;
/////////////////////////////////////////////////////
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 5062a4ea8..c2aee55f5 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 @@
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;
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 665af44ad..9fd4e450e 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 @@
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 2eafaaf72..2a8b9003f 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.response.IPAddressResponse;
-import org.apache.cloudstack.api.response.UserVmResponse;
-import org.apache.log4j.Logger;
-
+import org.apache.cloudstack.api.APICommand;
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 org.apache.cloudstack.api.response.IPAddressResponse;
+import org.apache.cloudstack.api.response.UserVmResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.event.EventTypes;
import com.cloud.network.IpAddress;
import com.cloud.user.Account;
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 3b4c4cd2c..19d2341fd 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 @@
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 3c145e9bd..1b050b896 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.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 89e72920d..933ee8bde 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,18 +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.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.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;
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 b449ff591..89aa71f8f 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 4c370c703..c82177599 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,18 +16,17 @@
// 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.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.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;
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 2a6ecf4ce..c04fba502 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,18 +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.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.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;
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 7f893ccd0..08a15eece 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;
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 0ca711f46..faa4f607e 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 e6ccfff34..321960115 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.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;
@@ -52,7 +52,7 @@ public class ListIsosCmd extends BaseListTaggedResourcesCmd {
private String hypervisor;
@Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType = TemplateResponse.class,
- description="list all isos by id")
+ description="list ISO by id")
private Long id;
@Parameter(name=ApiConstants.IS_PUBLIC, type=CommandType.BOOLEAN, description="true if the ISO is publicly available to all users, false otherwise.")
@@ -61,11 +61,14 @@ public class ListIsosCmd extends BaseListTaggedResourcesCmd {
@Parameter(name=ApiConstants.IS_READY, type=CommandType.BOOLEAN, description="true if this ISO is ready to be deployed")
private Boolean ready;
- @Parameter(name=ApiConstants.ISO_FILTER, type=CommandType.STRING, description="possible values are \"featured\", \"self\", \"self-executable\",\"executable\", and \"community\". " +
- "* featured-ISOs that are featured and are publicself-ISOs that have been registered/created by the owner. " +
- "* selfexecutable-ISOs that have been registered/created by the owner that can be used to deploy a new VM. " +
- "* executable-all ISOs that can be used to deploy a new VM " +
- "* community-ISOs that are public.")
+ @Parameter(name=ApiConstants.ISO_FILTER, type=CommandType.STRING, description="possible values are \"featured\", \"self\", \"selfexecutable\",\"sharedexecutable\",\"executable\", and \"community\". " +
+ "* featured : templates that have been marked as featured and public. " +
+ "* self : templates that have been registered or created by the calling user. " +
+ "* selfexecutable : same as self, but only returns templates that can be used to deploy a new VM. " +
+ "* sharedexecutable : templates ready to be deployed that have been granted to the calling user by another user. " +
+ "* executable : templates that are owned by the calling user, or public templates, that can be used to deploy a VM. " +
+ "* community : templates that have been marked as public but not featured. " +
+ "* all : all templates (only usable by admins).")
private String isoFilter = TemplateFilter.selfexecutable.toString();
@Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="list all isos by name")
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 fbc09d8bd..284d55308 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 @@
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 String getAccountName() {
public String getChecksum() {
return checksum;
}
+
+ public String getImageStoreUuid() {
+ return this.imageStoreUuid;
+ }
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
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 fd1ee3e22..37294e356 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,14 +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.ApiErrorCode;
-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;
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 b7a2c5685..5e884df40 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 50ac52e02..85062188e 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 256d4ff5c..5d2ef6898 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 72c317c89..e0f9bcdd8 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,18 +18,17 @@
import java.util.List;
-import org.apache.cloudstack.api.response.FirewallRuleResponse;
-import org.apache.cloudstack.api.response.UserVmResponse;
-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.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.SuccessResponse;
+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.network.rules.LoadBalancer;
diff --git a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/CreateLBHealthCheckPolicyCmd.java b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/CreateLBHealthCheckPolicyCmd.java
new file mode 100644
index 000000000..ac0ec3a9d
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/CreateLBHealthCheckPolicyCmd.java
@@ -0,0 +1,168 @@
+// 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.loadbalancer;
+
+
+import org.apache.cloudstack.api.response.FirewallRuleResponse;
+import org.apache.log4j.Logger;
+
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCreateCmd;
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
+import com.cloud.event.EventTypes;
+import com.cloud.exception.InvalidParameterValueException;
+import com.cloud.exception.ResourceAllocationException;
+import com.cloud.exception.ResourceUnavailableException;
+import com.cloud.network.rules.HealthCheckPolicy;
+import org.apache.cloudstack.api.response.LBHealthCheckResponse;
+import com.cloud.network.rules.LoadBalancer;
+import com.cloud.user.Account;
+import com.cloud.user.UserContext;
+
+
+@APICommand(name = "createLBHealthCheckPolicy", description = "Creates a Load Balancer healthcheck policy ", responseObject = LBHealthCheckResponse.class, since="4.2.0")
+@SuppressWarnings("rawtypes")
+public class CreateLBHealthCheckPolicyCmd extends BaseAsyncCreateCmd {
+ public static final Logger s_logger = Logger
+ .getLogger(CreateLBHealthCheckPolicyCmd.class.getName());
+
+ private static final String s_name = "createlbhealthcheckpolicyresponse";
+
+ // ///////////////////////////////////////////////////
+ // ////////////// API parameters /////////////////////
+ // ///////////////////////////////////////////////////
+
+ @Parameter(name = ApiConstants.LBID, type = CommandType.UUID, entityType = FirewallRuleResponse.class, required = true, description = "the ID of the load balancer rule")
+ private Long lbRuleId;
+
+ @Parameter(name = ApiConstants.DESCRIPTION, type = CommandType.STRING, description = "the description of the load balancer HealthCheck policy")
+ private String description;
+
+ @Parameter(name = ApiConstants.HEALTHCHECK_PINGPATH, type = CommandType.STRING, required = false, description = "HTTP Ping Path")
+ private String pingPath;
+
+ @Parameter(name = ApiConstants.HEALTHCHECK_RESPONSE_TIMEOUT, type = CommandType.INTEGER, required = false, description = "Time to wait when receiving a response from the health check (2sec - 60 sec)")
+ private int responsTimeOut;
+
+ @Parameter(name = ApiConstants.HEALTHCHECK_INTERVAL_TIME, type = CommandType.INTEGER, required = false, description = "Amount of time between health checks (1 sec - 20940 sec)")
+ private int healthCheckInterval;
+
+ @Parameter(name = ApiConstants.HEALTHCHECK_HEALTHY_THRESHOLD, type = CommandType.INTEGER, required = false, description = "Number of consecutive health check success before declaring an instance healthy")
+ private int healthyThreshold;
+
+ @Parameter(name = ApiConstants.HEALTHCHECK_UNHEALTHY_THRESHOLD, type = CommandType.INTEGER, required = false, description = "Number of consecutive health check failures before declaring an instance unhealthy")
+ private int unhealthyThreshold;
+
+ // ///////////////////////////////////////////////////
+ // ///////////////// Accessors ///////////////////////
+ // ///////////////////////////////////////////////////
+
+ public Long getLbRuleId() {
+ return lbRuleId;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public String getPingPath() {
+ return pingPath;
+ }
+
+ // ///////////////////////////////////////////////////
+ // ///////////// API Implementation///////////////////
+ // ///////////////////////////////////////////////////
+
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
+
+ @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
+ }
+
+ public int getResponsTimeOut() {
+ return responsTimeOut;
+ }
+
+ public int getHealthCheckInterval() {
+ return healthCheckInterval;
+ }
+
+ public int getHealthyThreshold() {
+ return healthyThreshold;
+ }
+
+ public int getUnhealthyThreshold() {
+ return unhealthyThreshold;
+ }
+
+ @Override
+ public void execute() throws ResourceAllocationException, ResourceUnavailableException {
+ HealthCheckPolicy policy = null;
+ boolean success = false;
+
+ try {
+ UserContext.current().setEventDetails("Load balancer healthcheck policy Id : " + getEntityId());
+ success = _lbService.applyLBHealthCheckPolicy(this);
+ if (success) {
+ // State might be different after the rule is applied, so get new object here
+ policy = _entityMgr.findById(HealthCheckPolicy.class, getEntityId());
+ LoadBalancer lb = _lbService.findById(policy.getLoadBalancerId());
+ LBHealthCheckResponse hcResponse = _responseGenerator.createLBHealthCheckPolicyResponse(policy, lb);
+ setResponseObject(hcResponse);
+ hcResponse.setResponseName(getCommandName());
+ }
+ } finally {
+ if (!success || (policy == null)) {
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create healthcheck policy ");
+ }
+ }
+ }
+
+ @Override
+ public void create() {
+ try {
+ HealthCheckPolicy result = _lbService.createLBHealthCheckPolicy(this);
+ this.setEntityId(result.getId());
+ this.setEntityUuid(result.getUuid());
+ } catch (InvalidParameterValueException e) {
+ s_logger.warn("Exception: ", e);
+ throw new ServerApiException(ApiErrorCode.MALFORMED_PARAMETER_ERROR , e.getMessage());
+ }
+ }
+
+ @Override
+ public String getEventType() {
+ return EventTypes.EVENT_LB_HEALTHCHECKPOLICY_CREATE;
+ }
+
+ @Override
+ public String getEventDescription() {
+ return "Create Load Balancer HealthCheck policy";
+ }
+}
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 90e89137b..02b253a7c 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,23 +19,22 @@
import java.util.Map;
-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.ApiErrorCode;
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.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;
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 28bde8f36..5f1d97b28 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,13 +18,10 @@
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.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;
@@ -32,6 +29,8 @@
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;
diff --git a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/DeleteLBHealthCheckPolicyCmd.java b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/DeleteLBHealthCheckPolicyCmd.java
new file mode 100644
index 000000000..bf91da51d
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/DeleteLBHealthCheckPolicyCmd.java
@@ -0,0 +1,116 @@
+// 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.loadbalancer;
+
+import org.apache.cloudstack.api.response.LBHealthCheckResponse;
+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.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.HealthCheckPolicy;
+import com.cloud.network.rules.LoadBalancer;
+import com.cloud.user.Account;
+import com.cloud.user.UserContext;
+
+@APICommand(name = "deleteLBHealthCheckPolicy", description = "Deletes a load balancer HealthCheck policy.", responseObject = SuccessResponse.class, since="4.2.0")
+public class DeleteLBHealthCheckPolicyCmd extends BaseAsyncCmd {
+ public static final Logger s_logger = Logger.getLogger(DeleteLBHealthCheckPolicyCmd.class.getName());
+ private static final String s_name = "deletelbhealthcheckpolicyresponse";
+ // ///////////////////////////////////////////////////
+ // ////////////// API parameters /////////////////////
+ // ///////////////////////////////////////////////////
+
+ @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = LBHealthCheckResponse.class,
+ required = true, description = "the ID of the load balancer HealthCheck policy")
+ private Long id;
+
+ // ///////////////////////////////////////////////////
+ // ///////////////// Accessors ///////////////////////
+ // ///////////////////////////////////////////////////
+
+ public Long getId() {
+ return id;
+ }
+
+ // ///////////////////////////////////////////////////
+ // ///////////// API Implementation///////////////////
+ // ///////////////////////////////////////////////////
+
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
+
+ @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 String getEventType() {
+ return EventTypes.EVENT_LB_HEALTHCHECKPOLICY_DELETE;
+ }
+
+ @Override
+ public String getEventDescription() {
+ return "deleting load balancer HealthCheck policy: " + getId();
+ }
+
+ @Override
+ public void execute() {
+ UserContext.current().setEventDetails("Load balancer healthcheck policy Id: " + getId());
+ boolean result = _lbService.deleteLBHealthCheckPolicy(getId() , true);
+
+ if (result) {
+ SuccessResponse response = new SuccessResponse(getCommandName());
+ this.setResponseObject(response);
+ } else {
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete load balancer healthcheck policy");
+ }
+ }
+
+ @Override
+ public String getSyncObjType() {
+ return BaseAsyncCmd.networkSyncObject;
+ }
+
+ @Override
+ public Long getSyncObjId() {
+ HealthCheckPolicy policy = _entityMgr.findById(HealthCheckPolicy.class,
+ getId());
+ if (policy == null) {
+ throw new InvalidParameterValueException("Unable to find load balancer healthcheck rule: " + id);
+ }
+ LoadBalancer lb = _lbService.findById(policy.getLoadBalancerId());
+ if (lb == null) {
+ throw new InvalidParameterValueException("Unable to find load balancer rule for healthcheck rule: " + id);
+ }
+ return lb.getNetworkId();
+ }
+}
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 6405dca16..fc7be24d4 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,21 +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.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.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;
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 84ce225fa..88fa400bb 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;
diff --git a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/ListLBHealthCheckPoliciesCmd.java b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/ListLBHealthCheckPoliciesCmd.java
new file mode 100644
index 000000000..cf5ea3238
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/ListLBHealthCheckPoliciesCmd.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.loadbalancer;
+
+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.LBHealthCheckResponse;
+import org.apache.cloudstack.api.response.LBStickinessResponse;
+import org.apache.cloudstack.api.response.ListResponse;
+
+import com.cloud.network.rules.HealthCheckPolicy;
+import com.cloud.network.rules.LoadBalancer;
+import com.cloud.user.Account;
+import com.cloud.user.UserContext;
+
+@APICommand(name = "listLBHealthCheckPolicies", description = "Lists load balancer HealthCheck policies.", responseObject = LBHealthCheckResponse.class, since="4.2.0")
+public class ListLBHealthCheckPoliciesCmd extends BaseListCmd {
+ public static final Logger s_logger = Logger
+ .getLogger(ListLBHealthCheckPoliciesCmd.class.getName());
+
+ private static final String s_name = "listlbhealthcheckpoliciesresponse";
+
+ // ///////////////////////////////////////////////////
+ // ////////////// API parameters /////////////////////
+ // ///////////////////////////////////////////////////
+ @Parameter(name = ApiConstants.LBID, type = CommandType.UUID, entityType = FirewallRuleResponse.class,
+ required = true, description = "the ID of the load balancer rule")
+ private Long lbRuleId;
+
+ // ///////////////////////////////////////////////////
+ // ///////////////// Accessors ///////////////////////
+ // ///////////////////////////////////////////////////
+ public Long getLbRuleId() {
+ return lbRuleId;
+ }
+
+ // ///////////////////////////////////////////////////
+ // ///////////// API Implementation///////////////////
+ // ///////////////////////////////////////////////////
+
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
+
+ @Override
+ public void execute() {
+ List hcpResponses = new ArrayList();
+ LoadBalancer lb = _lbService.findById(getLbRuleId());
+ ListResponse response = new ListResponse();
+
+ if (lb != null) {
+ List extends HealthCheckPolicy> healthCheckPolicies = _lbService.searchForLBHealthCheckPolicies(this);
+ LBHealthCheckResponse spResponse = _responseGenerator.createLBHealthCheckPolicyResponse(healthCheckPolicies, lb);
+ hcpResponses.add(spResponse);
+ response.setResponses(hcpResponses);
+ }
+
+ response.setResponseName(getCommandName());
+ this.setResponseObject(response);
+ }
+
+}
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 90708c0bf..9456a157f 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.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 374c6fb25..49ab42c32 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 @@
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 d0d4e8db8..e022cc78d 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 @@
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.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 54c136fae..92a05d6c9 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 @@
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.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.UserVmResponse;
import org.apache.cloudstack.api.response.SuccessResponse;
+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.network.rules.LoadBalancer;
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 dd2b360ec..c29605799 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;
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 7867f8de9..4cb5288ce 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,19 +18,18 @@
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;
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 9879cf501..b736b03a6 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,18 +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.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.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;
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 eded5a107..9bd769aca 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,18 +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.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.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;
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 f7cf5aad5..a0ec68ef5 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,18 +16,18 @@
// under the License.
package org.apache.cloudstack.api.command.user.nat;
-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.APICommand;
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;
@@ -59,6 +59,9 @@ public class EnableStaticNatCmd extends BaseCmd{
description="The network of the vm the static nat will be enabled for." +
" Required when public Ip address is not associated with any Guest network yet (VPC case)")
private Long networkId;
+ @Parameter(name = ApiConstants.VM_GUEST_IP, type = CommandType.STRING, required = false,
+ description = "VM guest nic Secondary ip address for the port forwarding rule")
+ private String vmSecondaryIp;
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
@@ -72,6 +75,13 @@ public Long getVirtualMachineId() {
return virtualMachineId;
}
+ public String getVmSecondaryIp() {
+ if (vmSecondaryIp == null) {
+ return null;
+ }
+ return vmSecondaryIp;
+ }
+
public long getNetworkId() {
IpAddress ip = _entityMgr.findById(IpAddress.class, getIpAddressId());
Long ntwkId = null;
@@ -110,7 +120,7 @@ public long getEntityOwnerId() {
@Override
public void execute() throws ResourceUnavailableException{
try {
- boolean result = _rulesService.enableStaticNat(ipAddressId, virtualMachineId, getNetworkId(), false);
+ boolean result = _rulesService.enableStaticNat(ipAddressId, virtualMachineId, getNetworkId(), false, getVmSecondaryIp());
if (result) {
SuccessResponse response = new SuccessResponse(getCommandName());
this.setResponseObject(response);
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 e4aaff3e5..776639b5f 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.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.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 d1289b8dd..2e307018e 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,18 +19,17 @@
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;
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 bbd8b5a74..fc7bd9fdd 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,21 +16,21 @@
// under the License.
package org.apache.cloudstack.api.command.user.network;
-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.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.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;
@@ -247,7 +247,7 @@ public String getIp6Cidr() {
return ip6Cidr.toLowerCase();
}
- /////////////////////////////////////////////////////
+ /////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
@Override
@@ -268,10 +268,6 @@ public long getEntityOwnerId() {
@Override
// an exception thrown by createNetwork() will be caught by the dispatcher.
public void execute() throws InsufficientCapacityException, ConcurrentOperationException, ResourceAllocationException{
- if (getStartIpv6() != null && getStartIp() != null) {
- throw new InvalidParameterValueException("Cannot support dualstack at this moment!");
- }
-
Network result = _networkService.createGuestNetwork(this);
if (result != null) {
NetworkResponse response = _responseGenerator.createNetworkResponse(result);
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 798bd43aa..2a2444b3e 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,18 +16,17 @@
// under the License.
package org.apache.cloudstack.api.command.user.network;
-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.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 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;
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 2104501d9..954146e0f 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;
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 f556ce1cb..d166974e7 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 @@
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 94bc71dc9..e2c970157 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 @@
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 1f366c223..afce0926e 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 @@
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 c6b5690ae..b054781b6 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.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.IPAddressResponse;
-import org.apache.cloudstack.api.response.SuccessResponse;
import org.apache.cloudstack.api.response.NetworkResponse;
+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;
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 978c71b94..a61474e69 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,17 +16,16 @@
// under the License.
package org.apache.cloudstack.api.command.user.network;
-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.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.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;
@@ -65,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 ///////////////////////
/////////////////////////////////////////////////////
@@ -95,6 +97,10 @@ public Boolean getChangeCidr() {
}
return false;
}
+
+ private String getGuestVmCidr() {
+ return guestVmCidr;
+ }
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
@@ -123,14 +129,9 @@ public void execute() throws InsufficientCapacityException, ConcurrentOperationE
throw new InvalidParameterValueException("Couldn't find network by id");
}
- Network result = null;
- if (network.getVpcId() != null) {
- result = _vpcService.updateVpcGuestNetwork(getId(), getNetworkName(), getDisplayText(), callerAccount,
- callerUser, getNetworkDomain(), getNetworkOfferingId(), getChangeCidr());
- } else {
- result = _networkService.updateGuestNetwork(getId(), getNetworkName(), getDisplayText(), callerAccount,
- callerUser, getNetworkDomain(), getNetworkOfferingId(), getChangeCidr());
- }
+ Network result = _networkService.updateGuestNetwork(getId(), getNetworkName(), getDisplayText(), callerAccount,
+ callerUser, getNetworkDomain(), getNetworkOfferingId(), getChangeCidr(), getGuestVmCidr());
+
if (result != null) {
NetworkResponse response = _responseGenerator.createNetworkResponse(result);
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 1fc7978f0..eb48d8142 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,16 +19,16 @@
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)
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 5f773d028..ca16cdc7e 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,17 +16,17 @@
// under the License.
package org.apache.cloudstack.api.command.user.offering;
-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 org.apache.log4j.Logger;
+
@APICommand(name = "listServiceOfferings", description="Lists all available service offerings.", responseObject=ServiceOfferingResponse.class)
public class ListServiceOfferingsCmd extends BaseListCmd {
public static final Logger s_logger = Logger.getLogger(ListServiceOfferingsCmd.class.getName());
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 8fd52753d..95889fe40 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.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.ProjectResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.event.EventTypes;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.projects.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 095cbfc49..7515f0513 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;
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 6f7467fad..9b61b6996 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,17 +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.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.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;
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 7ed857e57..27d1b50ca 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,17 +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.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.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;
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 4157daa7b..6e8b2da5d 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 321a19fe6..08cef1012 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.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 01e4082c1..e2f4bd621 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.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.ProjectResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.event.EventTypes;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InvalidParameterValueException;
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 01f56311d..e475bc7b8 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,16 +16,15 @@
// under the License.
package org.apache.cloudstack.api.command.user.project;
-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.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.ProjectResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.event.EventTypes;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.ResourceAllocationException;
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 637c63395..f34814a43 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;
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 000000000..07f93a456
--- /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/region/ha/gslb/AssignToGlobalLoadBalancerRuleCmd.java b/api/src/org/apache/cloudstack/api/command/user/region/ha/gslb/AssignToGlobalLoadBalancerRuleCmd.java
new file mode 100644
index 000000000..1c07a0aad
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/user/region/ha/gslb/AssignToGlobalLoadBalancerRuleCmd.java
@@ -0,0 +1,128 @@
+// 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.ha.gslb;
+
+import com.cloud.event.EventTypes;
+import com.cloud.exception.InvalidParameterValueException;
+import com.cloud.region.ha.GlobalLoadBalancerRule;
+import com.cloud.region.ha.GlobalLoadBalancingRulesService;
+import com.cloud.user.Account;
+import com.cloud.user.UserContext;
+import com.cloud.utils.StringUtils;
+import org.apache.cloudstack.api.*;
+import org.apache.cloudstack.api.response.FirewallRuleResponse;
+import org.apache.cloudstack.api.response.GlobalLoadBalancerResponse;
+import org.apache.cloudstack.api.response.SuccessResponse;
+import org.apache.log4j.Logger;
+
+import javax.inject.Inject;
+import java.util.List;
+
+@APICommand(name = "assignToGlobalLoadBalancerRule", description="Assign load balancer rule or list of load " +
+ "balancer rules to a global load balancer rules.", responseObject=SuccessResponse.class)
+public class AssignToGlobalLoadBalancerRuleCmd extends BaseAsyncCmd {
+
+ public static final Logger s_logger = Logger.getLogger(AssignToGlobalLoadBalancerRuleCmd.class.getName());
+
+ private static final String s_name = "assigntogloballoadbalancerruleresponse";
+
+ /////////////////////////////////////////////////////
+ //////////////// API parameters /////////////////////
+ /////////////////////////////////////////////////////
+
+ @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType = GlobalLoadBalancerResponse.class,
+ required=true, description="the ID of the global load balancer rule")
+ private Long id;
+
+ @Parameter(name=ApiConstants.LOAD_BALANCER_RULE_LIST, type=CommandType.LIST, collectionType=CommandType.UUID,
+ entityType = FirewallRuleResponse.class, required=true, description="the list load balancer rules that " +
+ "will be assigned to gloabal load balacner rule")
+ private List loadBalancerRulesIds;
+
+ /////////////////////////////////////////////////////
+ /////////////////// Accessors ///////////////////////
+ /////////////////////////////////////////////////////
+
+ public Long getGlobalLoadBalancerRuleId() {
+ return id;
+ }
+
+ public List getLoadBalancerRulesIds() {
+ return loadBalancerRulesIds;
+ }
+
+ /////////////////////////////////////////////////////
+ /////////////// API Implementation///////////////////
+ /////////////////////////////////////////////////////
+
+ @Inject
+ public GlobalLoadBalancingRulesService _gslbService;
+
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
+
+ @Override
+ public long getEntityOwnerId() {
+ GlobalLoadBalancerRule globalLoadBalancerRule = _entityMgr.findById(GlobalLoadBalancerRule.class,
+ getGlobalLoadBalancerRuleId());
+ if (globalLoadBalancerRule == null) {
+ return Account.ACCOUNT_ID_SYSTEM; // bad id given, parent this command to SYSTEM so ERROR events are tracked
+ }
+ return globalLoadBalancerRule.getAccountId();
+ }
+
+ @Override
+ public String getEventType() {
+ return EventTypes.EVENT_ASSIGN_TO_GLOBAL_LOAD_BALANCER_RULE;
+ }
+
+ @Override
+ public String getEventDescription() {
+ return "applying load balancer rules " + StringUtils.join(getLoadBalancerRulesIds(), ",") +
+ " to global load balancer rule " + getGlobalLoadBalancerRuleId();
+ }
+
+ @Override
+ public void execute(){
+ UserContext.current().setEventDetails("Global Load balancer rule Id: "+ getGlobalLoadBalancerRuleId()+ " VmIds: "
+ + StringUtils.join(getLoadBalancerRulesIds(), ","));
+ boolean result = _gslbService.assignToGlobalLoadBalancerRule(this);
+ if (result) {
+ SuccessResponse response = new SuccessResponse(getCommandName());
+ this.setResponseObject(response);
+ } else {
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to assign global load balancer rule");
+ }
+ }
+
+ @Override
+ public String getSyncObjType() {
+ return BaseAsyncCmd.gslbSyncObject;
+ }
+
+ @Override
+ public Long getSyncObjId() {
+ GlobalLoadBalancerRule gslb = _gslbService.findById(id);
+ if(gslb == null){
+ throw new InvalidParameterValueException("Unable to find load balancer rule: " + id);
+ }
+ return gslb.getId();
+ }
+}
diff --git a/api/src/org/apache/cloudstack/api/command/user/region/ha/gslb/CreateGlobalLoadBalancerRuleCmd.java b/api/src/org/apache/cloudstack/api/command/user/region/ha/gslb/CreateGlobalLoadBalancerRuleCmd.java
new file mode 100644
index 000000000..b08b6aeff
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/user/region/ha/gslb/CreateGlobalLoadBalancerRuleCmd.java
@@ -0,0 +1,182 @@
+// 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.ha.gslb;
+
+import com.cloud.async.AsyncJob;
+import com.cloud.event.EventTypes;
+import com.cloud.exception.ResourceAllocationException;
+import com.cloud.exception.ResourceUnavailableException;
+import com.cloud.region.ha.GlobalLoadBalancerRule;
+import com.cloud.region.ha.GlobalLoadBalancingRulesService;
+import com.cloud.user.UserContext;
+import org.apache.cloudstack.api.*;
+import org.apache.cloudstack.api.response.DomainResponse;
+import org.apache.cloudstack.api.response.GlobalLoadBalancerResponse;
+import org.apache.cloudstack.api.response.RegionResponse;
+import org.apache.log4j.Logger;
+
+import javax.inject.Inject;
+
+@APICommand(name = "createGlobalLoadBalancerRule", description="Creates a global load balancer rule",
+ responseObject=GlobalLoadBalancerResponse.class)
+public class CreateGlobalLoadBalancerRuleCmd extends BaseAsyncCreateCmd {
+
+ public static final Logger s_logger = Logger.getLogger(CreateGlobalLoadBalancerRuleCmd.class.getName());
+
+ private static final String s_name = "creategloballoadbalancerruleresponse";
+
+ /////////////////////////////////////////////////////
+ //////////////// API parameters /////////////////////
+ /////////////////////////////////////////////////////
+
+ @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, required=true, description="name of the load balancer rule")
+ private String globalLoadBalancerRuleName;
+
+ @Parameter(name=ApiConstants.DESCRIPTION, type=CommandType.STRING, description="the description of the load balancer rule", length=4096)
+ private String description;
+
+ @Parameter(name=ApiConstants.REGION_ID, type=CommandType.INTEGER, entityType = RegionResponse.class, required=true, description="region where the global load balancer is going to be created.")
+ private Integer regionId;
+
+ @Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, description="the account associated with the global load balancer. Must be used with the domainId parameter.")
+ private String accountName;
+
+ @Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.UUID, entityType = DomainResponse.class, description="the domain ID associated with the load balancer")
+ private Long domainId;
+
+ @Parameter(name=ApiConstants.GSLB_LB_METHOD, type=CommandType.STRING, required=false, description="load balancer algorithm (roundrobin, leastconn, proximity) " +
+ "that method is used to distribute traffic across the zones participating in global server load balancing, if not specified defaults to 'round robin'")
+ private String algorithm;
+
+ @Parameter(name=ApiConstants.GSLB_STICKY_SESSION_METHOD, type=CommandType.STRING, required=false, description="session sticky method (sourceip) if not specified defaults to sourceip")
+ private String stickyMethod;
+
+ @Parameter(name=ApiConstants.GSLB_SERVICE_DOMAIN_NAME, type = CommandType.STRING, required = true, description = "domain name for the GSLB service.")
+ private String serviceDomainName;
+
+ @Parameter(name=ApiConstants.GSLB_SERVICE_TYPE, type = CommandType.STRING, required = true, description = "GSLB service type (tcp, udp)")
+ private String serviceType;
+
+ /////////////////////////////////////////////////////
+ /////////////////// Accessors ///////////////////////
+ /////////////////////////////////////////////////////
+
+ public String getName() {
+ return globalLoadBalancerRuleName;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public String getAlgorithm() {
+ return algorithm;
+ }
+
+ public String getGslbMethod() {
+ return algorithm;
+ }
+
+ public String getStickyMethod() {
+ if (stickyMethod == null) {
+ return "sourceip";
+ }
+ return stickyMethod;
+ }
+
+ public String getServiceDomainName() {
+ return serviceDomainName;
+ }
+
+ public Integer getRegionId() {
+ return regionId;
+ }
+
+ public String getServiceType() {
+ return serviceType;
+ }
+
+ @Inject
+ private GlobalLoadBalancingRulesService _gslbService;
+
+ /////////////////////////////////////////////////////
+ /////////////// API Implementation///////////////////
+ /////////////////////////////////////////////////////
+
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
+
+ @Override
+ public void execute() throws ResourceAllocationException, ResourceUnavailableException {
+
+ UserContext callerContext = UserContext.current();
+ GlobalLoadBalancerRule rule = _entityMgr.findById(GlobalLoadBalancerRule.class, getEntityId());
+ GlobalLoadBalancerResponse response = null;
+ if (rule != null) {
+ response = _responseGenerator.createGlobalLoadBalancerResponse(rule);
+ setResponseObject(response);
+ }
+ response.setResponseName(getCommandName());
+ }
+
+ @Override
+ public void create() {
+ try {
+ GlobalLoadBalancerRule gslbRule = _gslbService.createGlobalLoadBalancerRule(this);
+ this.setEntityId(gslbRule.getId());
+ this.setEntityUuid(gslbRule.getUuid());
+ UserContext.current().setEventDetails("Rule Id: " + getEntityId());
+ } catch (Exception ex) {
+ s_logger.warn("Exception: ", ex);
+ throw new ServerApiException(ApiErrorCode.PARAM_ERROR, ex.getMessage());
+ }finally {
+
+ }
+ }
+
+ @Override
+ public String getEventType() {
+ return EventTypes.EVENT_GLOBAL_LOAD_BALANCER_CREATE;
+ }
+
+ @Override
+ public String getEventDescription() {
+ return "creating a global load balancer: " + getName() + " for account: " + getAccountName();
+
+ }
+
+ @Override
+ public AsyncJob.Type getInstanceType() {
+ return AsyncJob.Type.GlobalLoadBalancerRule;
+ }
+
+ @Override
+ public long getEntityOwnerId() {
+ Long accountId = finalyzeAccountId(accountName, domainId, null, true);
+ if (accountId == null) {
+ return UserContext.current().getCaller().getId();
+ }
+ return accountId;
+ }
+
+ public String getAccountName() {
+ return accountName;
+ }
+}
diff --git a/api/src/org/apache/cloudstack/api/command/user/region/ha/gslb/DeleteGlobalLoadBalancerRuleCmd.java b/api/src/org/apache/cloudstack/api/command/user/region/ha/gslb/DeleteGlobalLoadBalancerRuleCmd.java
new file mode 100644
index 000000000..424b10728
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/user/region/ha/gslb/DeleteGlobalLoadBalancerRuleCmd.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.user.region.ha.gslb;
+
+import com.cloud.async.AsyncJob;
+import com.cloud.event.EventTypes;
+import com.cloud.region.ha.GlobalLoadBalancerRule;
+import com.cloud.region.ha.GlobalLoadBalancingRulesService;
+import com.cloud.user.Account;
+import com.cloud.user.UserContext;
+import org.apache.cloudstack.api.*;
+import org.apache.cloudstack.api.response.GlobalLoadBalancerResponse;
+import org.apache.cloudstack.api.response.SuccessResponse;
+import org.apache.log4j.Logger;
+
+import javax.inject.Inject;
+
+@APICommand(name = "deleteGlobalLoadBalancerRule", description="Deletes a global load balancer rule.", responseObject=SuccessResponse.class)
+public class DeleteGlobalLoadBalancerRuleCmd extends BaseAsyncCmd {
+
+ public static final Logger s_logger = Logger.getLogger(DeleteGlobalLoadBalancerRuleCmd.class.getName());
+
+ private static final String s_name = "deletegloballoadbalancerruleresponse";
+
+ /////////////////////////////////////////////////////
+ //////////////// API parameters /////////////////////
+ /////////////////////////////////////////////////////
+
+ @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType = GlobalLoadBalancerResponse.class, required=true, description="the ID of the global load balancer rule")
+ private Long id;
+
+
+ /////////////////////////////////////////////////////
+ /////////////////// Accessors ///////////////////////
+ /////////////////////////////////////////////////////
+
+ public Long getGlobalLoadBalancerId() {
+ return id;
+ }
+
+ /////////////////////////////////////////////////////
+ /////////////// API Implementation///////////////////
+ /////////////////////////////////////////////////////
+
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
+
+ @Inject
+ public GlobalLoadBalancingRulesService _gslbService;
+
+ @Override
+ public long getEntityOwnerId() {
+ GlobalLoadBalancerRule lb = _entityMgr.findById(GlobalLoadBalancerRule.class, getGlobalLoadBalancerId());
+ if (lb != null) {
+ return lb.getAccountId();
+ }
+
+ return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent this command to SYSTEM so ERROR events are tracked
+ }
+
+ @Override
+ public String getEventType() {
+ return EventTypes.EVENT_LOAD_BALANCER_DELETE;
+ }
+
+ @Override
+ public String getEventDescription() {
+ return "deleting global load balancer: " + getGlobalLoadBalancerId();
+ }
+
+ @Override
+ public void execute(){
+ _gslbService.deleteGlobalLoadBalancerRule(this);
+ UserContext.current().setEventDetails("Deleting global Load balancer Id: " + getGlobalLoadBalancerId());
+ }
+
+ @Override
+ public String getSyncObjType() {
+ return BaseAsyncCmd.networkSyncObject;
+ }
+
+ @Override
+ public Long getSyncObjId() {
+ return null;
+ }
+
+ @Override
+ public AsyncJob.Type getInstanceType() {
+ return AsyncJob.Type.GlobalLoadBalancerRule;
+ }
+}
diff --git a/api/src/org/apache/cloudstack/api/command/user/region/ha/gslb/ListGlobalLoadBalancerRuleCmd.java b/api/src/org/apache/cloudstack/api/command/user/region/ha/gslb/ListGlobalLoadBalancerRuleCmd.java
new file mode 100644
index 000000000..d75de57f7
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/user/region/ha/gslb/ListGlobalLoadBalancerRuleCmd.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.region.ha.gslb;
+
+import com.cloud.region.ha.GlobalLoadBalancerRule;
+import com.cloud.region.ha.GlobalLoadBalancingRulesService;
+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.GlobalLoadBalancerResponse;
+import org.apache.cloudstack.api.response.ListResponse;
+import org.apache.cloudstack.api.response.RegionResponse;
+import org.apache.log4j.Logger;
+
+import javax.inject.Inject;
+import java.util.ArrayList;
+import java.util.List;
+
+@APICommand(name = "listGlobalLoadBalancerRules", description = "Lists load balancer rules.", responseObject = GlobalLoadBalancerResponse.class)
+public class ListGlobalLoadBalancerRuleCmd extends BaseListTaggedResourcesCmd {
+ public static final Logger s_logger = Logger.getLogger(ListGlobalLoadBalancerRuleCmd.class.getName());
+
+ private static final String s_name = "listgloballoadbalancerrulesresponse";
+
+ // ///////////////////////////////////////////////////
+ // ////////////// API parameters /////////////////////
+ // ///////////////////////////////////////////////////
+
+ @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = GlobalLoadBalancerResponse.class, description = "the ID of the global load balancer rule")
+ private Long id;
+
+ @Parameter(name = ApiConstants.REGION_ID, type = CommandType.INTEGER, entityType = RegionResponse.class, description = "region ID")
+ private Integer regionId;
+
+ // ///////////////////////////////////////////////////
+ // ///////////////// Accessors ///////////////////////
+ // ///////////////////////////////////////////////////
+
+ public Long getId() {
+ return id;
+ }
+
+ public Integer getRegionId() {
+ return regionId;
+ }
+
+ // ///////////////////////////////////////////////////
+ // ///////////// API Implementation///////////////////
+ // ///////////////////////////////////////////////////
+
+ @Inject
+ public GlobalLoadBalancingRulesService _gslbService;
+
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
+
+ @Override
+ public void execute() {
+ List globalLoadBalancers = _gslbService.listGlobalLoadBalancerRule(this);
+ ListResponse gslbRuleResponse = new ListResponse();
+ List gslbResponses = new ArrayList();
+ if (globalLoadBalancers != null) {
+ for (GlobalLoadBalancerRule gslbRule: globalLoadBalancers) {
+ GlobalLoadBalancerResponse gslbResponse = _responseGenerator.createGlobalLoadBalancerResponse(gslbRule);
+ gslbResponse.setObjectName("globalloadbalancerrule");
+ gslbResponses.add(gslbResponse);
+ }
+ }
+ gslbRuleResponse.setResponses(gslbResponses);
+ gslbRuleResponse.setResponseName(getCommandName());
+ this.setResponseObject(gslbRuleResponse);
+ }
+
+}
diff --git a/api/src/org/apache/cloudstack/api/command/user/region/ha/gslb/RemoveFromGlobalLoadBalancerRuleCmd.java b/api/src/org/apache/cloudstack/api/command/user/region/ha/gslb/RemoveFromGlobalLoadBalancerRuleCmd.java
new file mode 100644
index 000000000..fa051af54
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/user/region/ha/gslb/RemoveFromGlobalLoadBalancerRuleCmd.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.region.ha.gslb;
+
+import com.cloud.event.EventTypes;
+import com.cloud.exception.InvalidParameterValueException;
+import com.cloud.region.ha.GlobalLoadBalancerRule;
+import com.cloud.region.ha.GlobalLoadBalancingRulesService;
+import com.cloud.user.Account;
+import com.cloud.user.UserContext;
+import com.cloud.utils.StringUtils;
+import org.apache.cloudstack.api.*;
+import org.apache.cloudstack.api.response.FirewallRuleResponse;
+import org.apache.cloudstack.api.response.GlobalLoadBalancerResponse;
+import org.apache.cloudstack.api.response.SuccessResponse;
+import org.apache.log4j.Logger;
+
+import javax.inject.Inject;
+import java.util.List;
+
+@APICommand(name = "removeFromGlobalLoadBalancerRule", description="Removes a load balancer rule association with" +
+ " global load balancer rule", responseObject=SuccessResponse.class)
+public class RemoveFromGlobalLoadBalancerRuleCmd extends BaseAsyncCmd {
+ public static final Logger s_logger = Logger.getLogger(RemoveFromGlobalLoadBalancerRuleCmd.class.getName());
+
+ private static final String s_name = "removefromloadbalancerruleresponse";
+
+ /////////////////////////////////////////////////////
+ //////////////// API parameters /////////////////////
+ /////////////////////////////////////////////////////
+
+ @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType = GlobalLoadBalancerResponse.class,
+ required=true, description="The ID of the load balancer rule")
+ private Long id;
+
+ @Parameter(name=ApiConstants.LOAD_BALANCER_RULE_LIST, type=CommandType.LIST, collectionType=CommandType.UUID,
+ entityType = FirewallRuleResponse.class, required=true, description="the list load balancer rules that "
+ + "will be assigned to gloabal load balacner rule")
+ private List loadBalancerRulesIds;
+
+ /////////////////////////////////////////////////////
+ /////////////////// Accessors ///////////////////////
+ /////////////////////////////////////////////////////
+
+ public Long getGlobalLoadBalancerRuleId() {
+ return id;
+ }
+
+ public List